All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: Louis-Paul CORDIER <lpdev@cordier.org>,
	Adam Duskett <aduskett@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Andreas Naumann <anaumann@ultratronik.de>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 2/3] core/pkg-generic: fixup all PPD paths in a generic fashion
Date: Sat, 22 Jan 2022 11:50:17 +0100	[thread overview]
Message-ID: <20220122105017.GM3252931@scaer> (raw)
In-Reply-To: <20220113215805.GM1477939@scaer>

Arnout, All,

On 2022-01-13 22:58 +0100, Yann E. MORIN spake thusly:
> On 2022-01-12 21:42 +0100, Arnout Vandecappelle spake thusly:
> > On 08/01/2022 18:35, Yann E. MORIN wrote:
> > >Some files contain hard-coded absolute paths that point to the host
> > >and/or staging directories.
> > >
> > >With per-package directories (aka. PPD), these paths point to the PPD
> > >of the package that created the files, when we want them to point to the
> > >PPD of the package that uses them.
> [--SNIP--]
> > >+define PPD_FIXUP_PATHS
> > >+	$(Q)grep -lrZ '$(PER_PACKAGE_DIR)/[^/]\+/' $(HOST_DIR) \
> >  This will trawl to large binary files and potentially take a long time...
> 
> I too thought of that, and I even discussed it slightly with Peter K.
> here about what would be most efficient: grep-then-file, or file-then-grep?
> 
> But if we add --binary-files=without-match to grep, then it will
> bail-out early on binary files, which would be more efficient. And then
> we still pass that through file to really get only text files.
> 
> But a text-file with utf8 is really a binary file, so would grep ignore
> it?

So I tried and created a simple file with arbitrary non-ASCII UTF-8
symbols (I just copy-pasted the chinese Wikipedia home page, arbitarily
wrapped for "readability"):

    $ cat foo
    英格兰足球超级联赛金手套奖是英格兰足球超级联赛的一个奖项,
    每年颁发一次,颁给在当赛季英超联赛中完成最多次零封的守门员。
    在足球中,零封指的是守门员在一整场比赛中保持不失球。2005年,
    英超联赛第一次颁发金手套奖,切尔西的彼得·切赫获奖,切赫在
    2004-05赛季完成了24场零封,至今仍是英超联赛的记录。切赫和乔·
    哈特各赢得过四次金手套奖,并列获该奖次数最多的球员,切赫还是
    至今唯一一位为两家俱乐部(切尔西、阿森纳)效力时都获得金手套
    奖的球员。佩佩·雷纳则是第一个能够连续获得该奖的球员,他在2006
    至2008年连续三次获得英超金手套。乔·哈特则在2011-2013年追平了
    这一成就。

    $ file -b --mime-type foo
    text/plain

    $ grep --binary-files=without-match 是英超 foo
    2004-05赛季完成了24场零封,至今仍是英超联赛的记录。切赫和乔·

So, a text file with utf-8 chars is still recognied as a text file,
and grep will also not recognise it as a binary file.

So we can tell grep to bail out early on binary files, to speed up the
stuff. I'd still keep the 'file' test as a further safety net, though.

So, grep does not follow symlinks, and we can can speed grep by
instructing it to skip binary files. As such, I think all your issues
have been addressed now.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-01-22 10:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08 17:35 [Buildroot] [PATCH 0/3] core: fixup PPD paths (branch yem/ppd-fixup-paths) Yann E. MORIN
2022-01-08 17:35 ` [Buildroot] [PATCH 1/3] core/pkg-utils: properly indent per-package-rsync Yann E. MORIN
2022-01-08 17:52   ` Peter Korsgaard
2022-01-08 17:35 ` [Buildroot] [PATCH 2/3] core/pkg-generic: fixup all PPD paths in a generic fashion Yann E. MORIN
2022-01-09 12:14   ` Herve Codina
2022-01-12 20:42   ` Arnout Vandecappelle
2022-01-13 21:58     ` Yann E. MORIN
2022-01-22 10:50       ` Yann E. MORIN [this message]
2022-01-08 17:35 ` [Buildroot] [PATCH 3/3] core/pkg-generic: apply post-prepare hooks before monitoring directories Yann E. MORIN
2022-01-09 12:11   ` Herve Codina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220122105017.GM3252931@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=aduskett@gmail.com \
    --cc=anaumann@ultratronik.de \
    --cc=arnout@mind.be \
    --cc=buildroot@buildroot.org \
    --cc=lpdev@cordier.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.