Bug 1103927 - RPM: brp-25-symlink fails when link or link-dest contains whitespace
RPM: brp-25-symlink fails when link or link-dest contains whitespace
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Development
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: Ruediger Oertel
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-08-06 16:09 UTC by Stefan Brüns
Modified: 2019-10-16 12:46 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Brüns 2018-08-06 16:09:08 UTC
While building FlightGear-data, I get some errors during build
https://build.opensuse.org/package/live_build_log/home:StefanBruens:branches:games/FlightGear-data/openSUSE_Factory_ARM/aarch64

[  821s] /usr/lib/rpm/brp-suse.d/brp-25-symlink: line 163: test: too many arguments
[  821s] INFO: relinking /usr/share/flightgear/Video/NVIDIA Corporation/Quadro K2100M.xml -> NVIDIA (was //usr/share/flightgear/Video/NVIDIA Corporation/Quadro K1000M.xml)
[  821s] rm: cannot remove './/usr/share/flightgear/Video/NVIDIA': No such file or directory
[  821s] rm: cannot remove 'Corporation/Quadro': No such file or directory
[  821s] rm: cannot remove 'K2100M.xml': No such file or directory

There are obviously some missing quotes:
...
163            if test ! -L ./$link_dest && test ! -e $link_dest && test ! -e ./$link_dest; then
...
238      if [ "$new_link_dest" != NONE -a "$new_link_dest" != "$orig_link_dest" ]; then
239          echo "INFO: relinking $link -> $new_link_dest (was $orig_link_dest)"
240          rm ./$link && ln -s $new_link_dest ./$link
241      fi
...

$link and $orig_link_dest seem to be intact, but $new_link_dest is not

---
test case:
$> mkdir -p /tmp/brp_test/prefix/space\ dir/foo
$> mkdir -p /tmp/brp_test/prefix/space\ dir/bar
$> touch /tmp/brp_test/prefix/space\ dir/a
$> touch /tmp/brp_test/prefix/space\ dir/foo/f
$> ln -s /prefix/space\ dir/a /tmp/brp_test/prefix/space\ dir/b
$> ln -s /prefix/space\ dir/foo/f /tmp/brp_test/prefix/space\ dir/bar/b

$> find /tmp/brp_test/ -type l -printf "'%p' -> '%l'\n"
'/tmp/brp_test/prefix/space dir/bar/b' -> '/prefix/space dir/foo/f'
'/tmp/brp_test/prefix/space dir/b' -> '/prefix/space dir/a'

$> RPM_BUILD_ROOT=/tmp/brp_test /usr/lib/rpm/brp-suse.d/brp-25-symlink

---
Expected result:

INFO: relinking /prefix/space dir/bar/b -> ../foo/f (was /prefix/space dir/foo/f)
INFO: relinking /prefix/space dir/b -> a (was /prefix/space dir/a)

$> find /tmp/brp_test/ -type l -printf "'%p' -> '%l'\n"
'/tmp/brp_test/prefix/space dir/bar/b' -> '../foo/f'
'/tmp/brp_test/prefix/space dir/b' -> 'a'
---
Comment 1 Stefan Brüns 2018-08-06 16:31:43 UTC
https://github.com/openSUSE/brp-check-suse/pull/12
Comment 2 Ruediger Oertel 2019-10-16 12:46:33 UTC
Merged a while ago