Something wonky on LP Builds when copying symlinks from host

GIMP builds have suddenly stopped completing with a message that:

Failed to stage: Parts 'babl' and 'desktop-launch' have the following files, but with different contents:
    usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1

Both those parts list the following in their section of the log:

babl
Copying needed symlink target '/lib/x86_64-linux-gnu/libgcc_s.so.1' from host to satisfy '/build/gimp/parts/babl/install/usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1'.
desktop-launch
Copying needed symlink target '/lib/x86_64-linux-gnu/libgcc_s.so.1' from host to satisfy '/build/gimp/parts/desktop-launch/install/usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1'.

I think there is something wrong in Snapcraft that is detecting that these files, which should be identical, are different.

Log: https://launchpadlibrarian.net/527134224/buildlog_snap_ubuntu_bionic_amd64_632f1e2abb3eba0ca0b9eeb669601556_BUILDING.txt.gz

Is this reproduceable with snapcraft --use-lxd?

While Iā€™m not sure why the contents end up differing, Iā€™m wondering if we should not be copying host files if the file is found in the base snap?

I attempted a minimal reproducer:

name: my-snap-name # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  babl:
    plugin: nil
    stage-packages: [libgcc-7-dev]
  desktop-launch:
    plugin: nil
    stage-packages: [libgcc-7-dev]

Output looks similar, but it builds OK:

<snip>
Copying needed symlink target '/lib/x86_64-linux-gnu/libgcc_s.so.1' from host to satisfy '/root/parts/babl/install/usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1'.
Pulling babl 
+ snapcraftctl pull
Hit http://security.ubuntu.com/ubuntu bionic-security InRelease                                                                              
Hit http://archive.ubuntu.com/ubuntu bionic InRelease                                                                                        
Hit http://archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                                
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libgcc-7-dev_7.5.0-3ubuntu1~18.04_amd64.deb [2378 kB]                                                                                  
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libmpx2_8.4.0-1ubuntu1~18.04_amd64.deb [11.6 kB]                                                                                       
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 gcc-8-base_8.4.0-1ubuntu1~18.04_amd64.deb [18.7 kB]                                                                                    
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libitm1_8.4.0-1ubuntu1~18.04_amd64.deb [27.9 kB]                                                                                       
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 gcc-7-base_7.5.0-3ubuntu1~18.04_amd64.deb [18.3 kB]                                                                                    
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libcilkrts5_7.5.0-3ubuntu1~18.04_amd64.deb [42.5 kB]                                                                                   
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libasan4_7.5.0-3ubuntu1~18.04_amd64.deb [358 kB]                                                                                       
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libquadmath0_8.4.0-1ubuntu1~18.04_amd64.deb [134 kB]                                                                                   
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libtsan0_8.4.0-1ubuntu1~18.04_amd64.deb [288 kB]                                                                                       
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libubsan0_7.5.0-3ubuntu1~18.04_amd64.deb [126 kB]                                                                                      
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 liblsan0_8.4.0-1ubuntu1~18.04_amd64.deb [133 kB]                                                                                       
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libgomp1_8.4.0-1ubuntu1~18.04_amd64.deb [76.5 kB]                                                                                      
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Get:1 libatomic1_8.4.0-1ubuntu1~18.04_amd64.deb [9192 B]                                                                                     
Fetched 0 B in 0s (0 B/s)                                                                                                                    
Copying needed symlink target '/lib/x86_64-linux-gnu/libgcc_s.so.1' from host to satisfy '/root/parts/desktop-launch/install/usr/lib/gcc/x86_64-linux-gnu/7/libgcc_s.so.1'.
Pulling desktop-launch 
+ snapcraftctl pull
Building babl 
+ snapcraftctl build
Building desktop-launch 
+ snapcraftctl build
Staging babl 
+ snapcraftctl stage
Staging desktop-launch 
+ snapcraftctl stage
Priming babl 
+ snapcraftctl prime
Priming desktop-launch 
+ snapcraftctl prime
Snapping |                                                                                                                         
Snapped my-snap-name_0.1_amd64.snap

Tried the above with destructive mode and lxd.

Run the review tools against this snap, generally the only symlinks allowed to the base snap are the ones pointing to libc6 libraries.

Iā€™ve just kicked-off a local build to run for the next hour or so to see whether this is reproducible with --use-lxd.

ok, Iā€™ve reproduced this with the same build definition in a local --use-lxd run. Iā€™m now going to find the most minimal testcase I canā€¦

Iā€™ve found a fix, but still havenā€™t worked out how to reproduce it in a small testcase. The problem seems to be related to an accidentally-staged g++ package in the desktop-launch part of gimp. Iā€™ve filed a PR to remove that accident.

I think Iā€™ve figured out the issue and have proposed a fix:

1 Like