From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B4F981382C5 for ; Tue, 23 Mar 2021 09:23:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7E3F4E0855; Tue, 23 Mar 2021 09:23:17 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3F7C1E0801 for ; Tue, 23 Mar 2021 09:23:17 +0000 (UTC) Message-ID: Subject: Re: [gentoo-dev] rfc: usrmerge script From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: sam@gentoo.org, soap@gentoo.org Date: Tue, 23 Mar 2021 10:23:11 +0100 In-Reply-To: References: Organization: Gentoo Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 6d1c8079-a355-4ae4-b4a5-d8b80eea405d X-Archives-Hash: a4aa0e5704eecc4af5c4a3c53b9b3496 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