NetBSD Problem Report #57593

From khorben@defora.org  Sat Aug 26 04:22:04 2023
Return-Path: <khorben@defora.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D2BF11A9238
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 26 Aug 2023 04:22:04 +0000 (UTC)
Message-Id: <20230826002724.AECEA37513@reapr.station.defora>
Date: Sat, 26 Aug 2023 02:27:24 +0200 (CEST)
From: Pierre Pronchery <khorben@defora.org>
Reply-To:
To: gnats-bugs@NetBSD.org
Subject: xz is missing from the rescue set
X-Send-Pr-Version: 3.95

>Number:         57593
>Category:       install
>Synopsis:       xz should be a rescue tool at least where USE_XZ_SETS is set
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 26 04:25:00 +0000 2023
>Last-Modified:  Mon Sep 04 00:05:01 +0000 2023
>Originator:     Pierre Pronchery <khorben@defora.org>
>Release:        NetBSD 9.3_STABLE
>Organization:
>Environment:
System: NetBSD reapr.station.defora 9.3_STABLE NetBSD 9.3_STABLE (GENERIC) #0: Sun Mar 26 02:04:14 UTC 2023 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
On platforms where sets are distributed as xz files (amd64, sparc64, and
aarch64 AFAICT) there is no way to uncompress the sets from the tools
available in /rescue. I think this is quite inconvenient, especially
since gz is available there (as expected).
>How-To-Repeat:
Break the system on a NetBSD/amd64 host (eg by downgrading a -10
userland to a -9 userland) such that lib*.so point to the wrong place.
Try to uncompress a .tar.xz set with /rescue and fail.
>Fix:
I am not very familiar with that part of the system, but the following
patch did the trick for me:

From 7fd62cccefbf25c2fd0d860cc45b4a04dde57573 Mon Sep 17 00:00:00 2001
From: Pierre Pronchery <khorben@EdgeBSD.org>
Date: Sat, 26 Aug 2023 00:16:23 +0200
Subject: [PATCH] distrib: add xz to the rescue set

This is useful on platforms where sets are distributed as xz files, when
something goes wrong (eg on amd64).
---
 distrib/sets/lists/rescue/mi | 1 +
 rescue/list                  | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/distrib/sets/lists/rescue/mi b/distrib/sets/lists/rescue/mi
index 41f16b7e080f..8cc28eb0cf08 100644
--- a/distrib/sets/lists/rescue/mi
+++ b/distrib/sets/lists/rescue/mi
@@ -163,6 +163,7 @@
 ./rescue/vndconfig				base-rescue-root
 ./rescue/wdogctl				base-rescue-root
 ./rescue/wsconsctl				base-rescue-root
+./rescue/xz					base-rescue-root
 ./rescue/zcat					base-rescue-root
 ./rescue/zegrep					base-rescue-root
 ./rescue/zfgrep					base-rescue-root
diff --git a/rescue/list b/rescue/list
index a2160f7d811e..5f9f892074e4 100644
--- a/rescue/list
+++ b/rescue/list
@@ -154,3 +154,9 @@ PROG	lfs_cleanerd

 LIBS	liboverride.o
 LIBS	-lbz2 -llzma -lcrypt -ledit -lipsec -lkvm -ll -lm -lrmt -lcurses -lterminfo -lutil -lz -levent -lprop
+
+SRCDIRS	external/public-domain/xz/bin
+
+PROG	xz
+
+LIBS	-llzma -lintl -lpthread
-- 
2.41.0

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/57593: xz is missing from the rescue set
Date: Sat, 26 Aug 2023 04:52:27 -0000 (UTC)

 khorben@defora.org (Pierre Pronchery) writes:

 >On platforms where sets are distributed as xz files (amd64, sparc64, and
 >aarch64 AFAICT) there is no way to uncompress the sets from the tools
 >available in /rescue. I think this is quite inconvenient, especially
 >since gz is available there (as expected).

 From gzip(1):
      This version of gzip is also capable of decompressing files compressed
      using compress(1), bzip2(1), lzip, or xz(1).

 and that's also true for the version built for /rescue.

From: Pierre Pronchery <khorben@defora.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/57593: xz is missing from the rescue set
Date: Mon, 4 Sep 2023 02:03:31 +0200

 --Apple-Mail=_5C20C9E1-6419-46D9-876D-F5F5684A5081
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8

 			Hi,

 > On 26. Aug 2023, at 06:55, Michael van Elst <mlelstv@serpens.de> =
 wrote:
 >=20
 > The following reply was made to PR install/57593; it has been noted by =
 GNATS.
 >=20
 > From: mlelstv@serpens.de (Michael van Elst)
 > To: gnats-bugs@netbsd.org
 > Cc:=20
 > Subject: Re: install/57593: xz is missing from the rescue set
 > Date: Sat, 26 Aug 2023 04:52:27 -0000 (UTC)
 >=20
 > khorben@defora.org (Pierre Pronchery) writes:
 >=20
 >> On platforms where sets are distributed as xz files (amd64, sparc64, =
 and
 >> aarch64 AFAICT) there is no way to uncompress the sets from the tools
 >> available in /rescue. I think this is quite inconvenient, especially
 >> since gz is available there (as expected).
 >=20
 > =46rom gzip(1):
 >      This version of gzip is also capable of decompressing files =
 compressed
 >      using compress(1), bzip2(1), lzip, or xz(1).
 >=20
 > and that's also true for the version built for /rescue.

 Thanks, I had forgotten about that during the rescue operation. Still I =
 think that improvements are possible with regards to this process:

 - linking lzmadec, uncompress, and xzdec binaries to gzip in /rescue =
 (patch attached)
 - when calling /rescue/tar xzvf on a .tar.xz file, I get: (simulating a =
 situation without working /bin or /usr)

 # file test.tar.xz
 test.tar.xz: XZ compressed data
 # PATH=3D /rescue/tar -xzvf test.tar.xz                                  =
                                                                          =
                                                                          =
                                               =20
 tar: could not exec: No such file or directory
 tar: End of archive volume 1 reached
 tar: Sorry, unable to determine archive format.

   =E2=80=A6which is what got me confused originally.

 Therefore I think we should ship /rescue/tar so that it defaults to the =
 binaries available in /rescue, regardless of what $PATH says.

 Can I commit this patch, and would it make sense to modify /rescue/tar =
 this way?


 --Apple-Mail=_5C20C9E1-6419-46D9-876D-F5F5684A5081
 Content-Disposition: attachment;
 	filename=patch-rescue_lzmadec_uncompress_xzdec.diff
 Content-Type: application/octet-stream;
 	x-unix-mode=0600;
 	name="patch-rescue_lzmadec_uncompress_xzdec.diff"
 Content-Transfer-Encoding: 7bit

 diff --git a/distrib/sets/lists/rescue/mi b/distrib/sets/lists/rescue/mi
 index 7ac808e44b4f..e06aeb5d6420 100644
 --- a/distrib/sets/lists/rescue/mi
 +++ b/distrib/sets/lists/rescue/mi
 @@ -74,6 +74,7 @@
  ./rescue/lmcctl					base-obsolete	obsolete
  ./rescue/ln					base-rescue-root
  ./rescue/ls					base-rescue-root
 +./rescue/lzmadec				base-rescue-root
  ./rescue/mbrlabel				base-rescue-root
  ./rescue/mkdir					base-rescue-root
  ./rescue/mknod					base-rescue-root
 @@ -157,12 +158,14 @@
  ./rescue/tunefs					base-rescue-root
  ./rescue/umbctl					base-rescue-root
  ./rescue/umount					base-rescue-root
 +./rescue/uncompress				base-rescue-root
  ./rescue/veriexecctl				base-rescue-root
  ./rescue/vi					base-rescue-root
  ./rescue/vnconfig				base-rescue-root
  ./rescue/vndconfig				base-rescue-root
  ./rescue/wdogctl				base-rescue-root
  ./rescue/wsconsctl				base-rescue-root
 +./rescue/xzdec					base-rescue-root
  ./rescue/zcat					base-rescue-root
  ./rescue/zegrep					base-rescue-root
  ./rescue/zfgrep					base-rescue-root
 diff --git a/rescue/list b/rescue/list
 index 9e0575a91eeb..8998ebf53216 100644
 --- a/rescue/list
 +++ b/rescue/list
 @@ -124,7 +124,7 @@ SRCDIRS	usr.bin
  PROG	bzip2		bunzip2 bzcat
  PROG	ftp
  PROG	grep		egrep fgrep zgrep zegrep zfgrep
 -PROG	gzip		gunzip gzcat zcat 
 +PROG	gzip		gunzip gzcat lzmadec uncompress xzdec zcat
  PROG	kdump
  PROG	ktrace
  PROG	ktruss

 --Apple-Mail=_5C20C9E1-6419-46D9-876D-F5F5684A5081
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii



 Cheers & HTH,
 -- 
 khorben
 --Apple-Mail=_5C20C9E1-6419-46D9-876D-F5F5684A5081--

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.