[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#469085: live-helper: md5sum can't handle all filenames



Bas Wijnen wrote:
> Package: live-helper
> Version: 1.0~a38-1
> Tags: patch
> 
> When including files in the binary image which have strange characters
> in them (I think even spaces, but certainly quotes), lh_binary_md5sum
> chokes due to xargs parsing those characters.  The problematic line is
> 
> 	find . -type f | sort | grep -v 'isolinux/isolinux.bin' | grep
> 	-v 'boot/grub/stage2_eltorito' | xargs -I{} md5sum "{}" >
> 	../md5sum.txt
> 
> The error message (when having files with quotes) suggests using the -0
> option.  This is a good idea, but needs '\0'-separated fields.  So the
> line becomes:
> 
> 	find . -type f | sort | grep -v 'isolinux/isolinux.bin' | grep
> 	-v 'boot/grub/stage2_eltorito' | while read file ; do echo -en
> 	"$file\0" ; done | xargs -0 -I{} md5sum "{}" > ../md5sum.txt
I would suggest:

find . -type f \! -name 'isolinux/isolinux.bin' \! -name
'boot/grub/stage2_eltorito' -print0 | xargs -0 md5sum > ../md5sum.txt
> 
> I'm not entirely sure if there're bashisms in there, but I don't think
> so.  I tested this (with bash) and it can indeed handle files with
> spaces and quotes in their names.
The option -e of echo is not part of the POSIX standard, but provided by bash's
echo, ksh's echo and /bin/echo.

> 
> Thanks,
> Bas
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> debian-live-devel mailing list
> debian-live-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel


-- 
Julian Andres Klode, Fellow of the Free Software Foundation Europe
                     Debian Maintainer | Developer | Ubuntu Member

try Debian: http://www.debian.org/ | my site: http://jak-linux.org/
        jabber: juliank at jabber.org | IRC: juliank (FreeNode, OFTC)
            languages:     German  | English

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.alioth.debian.org/pipermail/debian-live-devel/attachments/20080317/5c622838/attachment.pgp 


Reply to: