Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #56052

Bug#847325: Unable to copy symlinks with copy_file

From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#847325: Unable to copy symlinks with copy_file
Date 2016-12-08 03:20 +0100
Message-ID <sLWtr-8ph-1@gated-at.bofh.it> (permalink)
References <sLWtr-8ph-17@gated-at.bofh.it> <sLI78-7uU-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, 2016-12-07 at 11:46 +0100, Vincent Bernat wrote:
[...]
> I have this error on update-initramfs -u -vv:
> 
> Adding firmware /lib/firmware/nvidia/gm206/gr/gpccs_data.bin
> Adding firmware-link /lib/firmware/nvidia/gm206/gr/gpccs_inst.bin
> Adding firmware /usr/lib/firmware/nvidia/gm200/gr/gpccs_inst.bin
> Adding firmware-link /lib/firmware/nvidia/gm206/gr/gpccs_bl.bin
> E: /usr/share/initramfs-tools/hooks/plymouth failed with return 1.
> Removing /boot/initrd.img-4.8.0-2-amd64.dpkg-bak
> update-initramfs: failed for /boot/initrd.img-4.8.0-2-amd64 with 1.
> 
> I have traced to this:
> 
> + copy_file firmware /lib/firmware/nvidia/gm206/gr/gpccs_bl.bin
> + local type src target link_target
> + type=firmware
> + src=/lib/firmware/nvidia/gm206/gr/gpccs_bl.bin
> + target=/lib/firmware/nvidia/gm206/gr/gpccs_bl.bin
> + [ -f /lib/firmware/nvidia/gm206/gr/gpccs_bl.bin ]
> + [ -d /var/tmp/mkinitramfs_S838WR//lib/firmware/nvidia/gm206/gr/gpccs_bl.bin ]
> + [ -e /var/tmp/mkinitramfs_S838WR//lib/firmware/nvidia/gm206/gr/gpccs_bl.bin ]
> + mkdir -p /var/tmp/mkinitramfs_S838WR//lib/firmware/nvidia/gm206/gr
> + [ -h /lib/firmware/nvidia/gm206/gr/gpccs_bl.bin ]
> + readlink -f /lib/firmware/nvidia/gm206/gr/gpccs_bl.bin
> + link_target=/usr/lib/firmware/nvidia/gm200/gr/gpccs_bl.bin
> + [ /usr/lib/firmware/nvidia/gm200/gr/gpccs_bl.bin != /lib/firmware/nvidia/gm206/gr/gpccs_bl.bin ]
> + [ y = y ]
> + echo Adding firmware-link /lib/firmware/nvidia/gm206/gr/gpccs_bl.bin
> Adding firmware-link /lib/firmware/nvidia/gm206/gr/gpccs_bl.bin
> + ln -rs /var/tmp/mkinitramfs_S838WR//usr/lib/firmware/nvidia/gm200/gr/gpccs_bl.bin /var/tmp/mkinitramfs_S838WR//lib/firmware/nvidia/gm206/gr/gpccs_bl.bin
> + src=/usr/lib/firmware/nvidia/gm200/gr/gpccs_bl.bin
> + target=/usr/lib/firmware/nvidia/gm200/gr/gpccs_bl.bin
> + [ -e /var/tmp/mkinitramfs_S838WR//usr/lib/firmware/nvidia/gm200/gr/gpccs_bl.bin ]
> + return 1
> 
> Maybe the check should also use cmp.

It should not.  copy_file is documented to return 1 in case the target
already exists, and some of its callers rely on that to skip looking at
the file's dependencies.

If copy_file copies a symlink, it then moves on to copying the link-
target.  It also returns 1 if that already exists in the initramfs, but
this is not obvious from the documentation.  It seems to make more
sense to return 0 in this case and reserve 1 for the case that nothing 
at all was copied.

(Annoyingly, I couldn't reproduce this at first because I tried just
adding nouveau to /etc/initramfs-tools/modules.  Since mkinitramfs does
*not* use 'set -e' (unlike most hooks), the 'failure' of copy_file was
not fatal.)

Ben.

-- 
Ben Hutchings
When in doubt, use brute force. - Ken Thompson

Back to linux.debian.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#847325: Unable to copy symlinks with copy_file Vincent Bernat <bernat@debian.org> - 2016-12-07 12:00 +0100
  Bug#847325: Unable to copy symlinks with copy_file Ben Hutchings <ben@decadent.org.uk> - 2016-12-08 03:20 +0100
    Bug#847325: Unable to copy symlinks with copy_file Vincent Bernat <bernat@debian.org> - 2016-12-08 07:40 +0100

csiph-web