On Sun, 2021-03-21 at 12:39 -0500, William Hubbs wrote:
> All,
> 
> the following is a script which will migrate a Gentoo system to the usr
> merge layout. This is similar to the unsymlink-lib tool used to migrate
> a system  from the 17.0 to the 17.1 profiles.
> 
> I'm attaching it here to get some comments before I package it, so
> please let me know if I have missed something.

To be honest, I don't think critical system modifications should be done
in shell script, and especially not via a fringe non-standards complaint
shell implementation in busybox.  Even if you can assume you make no
mistakes, shell is unreliable by design.  For example, your script may
start behaving in unexpected ways if you run out of space.

You don't seem to be handling file collisions at all.  Even today we
have files like /bin/bzip2 and /usr/bin/bzip2, not to mention shared
libraries.  Silently ignoring the problem or requiring the users to
manually ensure their system is clean is not going to solve it.

You don't seem to provide any helpful messages.  When things fail, user
will be left in the blue with an error message from some system tool (or
rather, cheap-ass busybox rewrite, I guess).

Also, have you verified that busybox's cp(1) actually preserves all file
properties (including xattrs, ACLs, caps...)?

Please don't forget to include tests with it.  Docker's good for testing
stuff like this.

-- 
Best regards,
Michał Górny



Reply via email to