Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 417263 - sys-apps/busybox[make-symlinks] should not overwrite existing files
Summary: sys-apps/busybox[make-symlinks] should not overwrite existing files
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Embedded Gentoo Team
Keywords: PATCH
Depends on:
Reported: 2012-05-23 12:30 UTC by Maksim 'max_posedon' Melnikau
Modified: 2021-02-12 17:28 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

cp -n (--no-clobber) is not destructive (busybox-1.20.1.ebuild.patch,411 bytes, patch)
2012-06-24 22:31 UTC, Maksim 'max_posedon' Melnikau
Details | Diff
force cp to be nondestructive (busybox-1.30.1.ebuild.patch,498 bytes, patch)
2020-02-09 04:44 UTC, Chris Slycord
Details | Diff
Make USE=make-symlinks safer (busybox-1.31.1-r3.ebuild-safe-make-symlinks.patch,1.40 KB, patch)
2020-11-29 06:00 UTC, Raffaello D. Di Napoli
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim 'max_posedon' Melnikau 2012-05-23 12:30:35 UTC
For small/embedded systems busybox can be used as big part of the system (USE="make-symlinks"), but sometimes its important to have regular tools (kbd/util-linux/shadow/etc). In this case updating busybox's symlinks overwrite important parts of the system.

I suggest use tar "keep-old-files" mode for creating symlinks (tar -k)

Reproducible: Always
Comment 1 Maksim 'max_posedon' Melnikau 2012-06-24 22:31:02 UTC
Created attachment 316189 [details, diff]
cp -n (--no-clobber) is not destructive

This patch makes ebuild less destructive, in cases when you want use busybox for most, but not all system components.
Comment 2 SpanKY gentoo-dev 2012-06-28 04:01:46 UTC
Comment on attachment 316189 [details, diff]
cp -n (--no-clobber) is not destructive

i don't think that'll work as that flag isn't in POSIX :/
Comment 3 Chris Slycord 2020-02-09 04:44:43 UTC
Created attachment 612890 [details, diff]
force cp to be nondestructive

Posix compliant workaround for non-destructive cp
Comment 4 Raffaello D. Di Napoli 2020-11-29 06:00:47 UTC
Created attachment 675667 [details, diff]
Make USE=make-symlinks safer

Here’s another approach: only install an applet symlink if that name cannot be found in the usual /usr/sbin:/usr/bin:/sbin:/bin .

This guarantees the user can’t screw their system up, because it prevents a BB applet from both overwriting and hiding the “full” program (by installing a symlink in a different directory).