This command does not reports the warning :

find . -depth -print | cpio --create --format='newc' >
../../initrd.img-5.10.0-19-amd64
554538 blocks.

and :

# cat initrd.img-5.10.0-19-amd64-depth | cpio -t | sort >/tmp/with_depth
554538 blocks

# cat initrd.img-5.10.0-19-amd64-depth | cpio -t | sort >/tmp/no_depth
554538 blocks

# diff with_depth no_depth | less

no difference.


Il giorno ven 28 ott 2022 alle ore 12:46 Thomas Schmitt <[email protected]>
ha scritto:

> Hi,
>
> Mario Marietto wrote:
> > There are some kb of difference between the files produced by the two
> > techniques :
> > 79.3 MiB (83,106,001 byte) : find . -print -depth | cpio --create
> > --format='newc' > ../../initrd.img-5.10.0-18-amd64
> > 79.3 MiB (83,108,291 byte) : find . | cpio --create --format='newc' >
> > ../../initrd.img-5.10.0-18-amd64
>
> I would only worry if cpio -t would show significant differences.
> The find option -depth influences the sequence of names. So i would do:
>
>   find . -print -depth | cpio ...
>
>   cat ../../initrd.img-5.10.0-18-amd64 | cpio -t | sort >/tmp/with_depth
>
>   find . | cpio ...
>
>   cat ../../initrd.img-5.10.0-18-amd64 | cpio -t | sort >/tmp/without_depth
>
>   diff /tmp/with_depth /tmp/without_depth | less
>
> If the content is the same, then no differences should be reported.
>
>
> The documentation of cpio states that the find run with -depth is to
> prefer.
>
>   The '-depth' option forces 'find' to print of the entries in a
>   directory before printing the directory itself. This limits the effects
>   of restrictive directory permissions by printing the directory entries
>   in a directory before the directory name itself.
>
> Probably this means that at restore time potential write resctrictions
> of the directory will only be applied after the files of the directory
> have been copied out of the cpio archive into the directory.
>
>
> > find: warning: you have specified the global option -depth after the
> > argument -print, but global options are not positional, i.e., -depth
> affects
> > tests specified before it as well as those specified after it.  Please
> > specify global options before other arguments.
> >
> > It is a warning,not an error. But why does it happens ? Can I "fx" it ?
>
> Follow the program's advise and do not put -print before -depth.
> I get no warning with
>
>   find . -depth 2>&1 | less
>
>   find . -depth -print 2>&1 | less
>
> -print is surplus here, anyways. man find says:
>
>   find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]
>   ...
>   If no expression is given, the  expression  -print  is  used
>
>
> (Do you really get that warning from
>   find . 2>&1 | less
> ? There is no -depth to complain about, and my local find does not warn.)
>
>
> Have a nice day :)
>
> Thomas
>
>

-- 
Mario.

Reply via email to