Re: a patch to replace zipinfo with bsdunzip

"Xi Ruoyao" ([email protected] via alfs-discuss Mailing List) <[email protected]> Tue, 18 Feb 2025 14:40:30 +0800
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
On Tue, 2025-02-18 at 12:27 +0800, Zhang Wen wrote:
> 在 2025/2/18 7:30, Ken Moffat ([email protected] via alfs-discuss
> Mailing List) 写道:
> > On Sun, Feb 16, 2025 at 12:49:42PM +0800, Zhang Wen wrote:
> > > Not sure if there's a better way to do this, it seems tricky to use
> > > awk and tail commands.
> > > 
> > > diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
> > > index 0bf4348..825fde1 100644
> > > --- a/BLFS/xsl/scripts.xsl
> > > +++ b/BLFS/xsl/scripts.xsl
> > > @@ -349,7 +349,7 @@ case $PACKAGE in
> > >        JH_UNPACKDIR=`head -n1 unpacked | cut  -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
> > >        ;;
> > >     *.zip)
> > > -     zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
> > > +     bsdunzip -1 $SRC_DIR/$PACKAGE|awk '{print $4}'|tail -n +3 &gt; unpacked
> > 
> > Should that not be -l (lowercase L) rather than -1 ?
> > 
> > I'm on an older version on this machine, apologies if -1 is now an
> > option.
> > 
> >   ĸen
> > 
> > 
> My fault, it should be -l(lowercase L) instead of -1.
> 
> diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
> index 0bf4348..3f23c6e 100644
> --- a/BLFS/xsl/scripts.xsl
> +++ b/BLFS/xsl/scripts.xsl
> @@ -349,7 +349,7 @@ case $PACKAGE in
>        JH_UNPACKDIR=`head -n1 unpacked | cut  -d" " -f2 | sed 
> 's@^\./@@;s@/.*@@'`
>        ;;
>     *.zip)
> -     zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
> +     bsdunzip -l $SRC_DIR/$PACKAGE|awk '{print $4}'|tail -n +3 &gt; 
> unpacked

Your patch is broken up by your mail client.

And it's better to use "bsdtar --list -f" so we don't need awk and tail.
Using awk would be also problematic if the zip file contains a file name
with a whitespace (and I don't know if it can be fixed at all).

-- 
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page