On Sat, Aug 20, 2016 at 01:28:23PM +0200, Jan Stary wrote:
> On current/amd64, fsdb(8) fails like this:
>
> # fsdb -f /dev/rsd0l
> ** /dev/rsd0l
> Editing file system `/dev/rsd0l'
> Last Mounted on /usr/xenocara
> current inode: directory
> I=2 MODE=40755 SIZE=512
> MTIME=Aug 8 19:27:56 2016 [0 nsec]
> CTIME=Aug 8 19:27:56 2016 [0 nsec]
> ATIME=Aug 8 19:27:56 2016 [0 nsec]
> OWNER=root GRP=wheel LINKCNT=2 FLAGS=0 BLKCNT=4 GEN=f3a7fd9
> Abort trap (core dumped)
Thanks for the report and the analysis. fsdb(8) uses editline(3), hence
it needs "rpath tty". The conservative fix would be as follows.
fsdb(8) isn't on bsd.rd, hence we don't need to change the SMALL case.
Index: setup.c
===================================================================
RCS file: /var/cvs/src/sbin/fsck_ffs/setup.c,v
retrieving revision 1.60
diff -u -p -r1.60 setup.c
--- setup.c 24 Nov 2015 21:42:54 -0000 1.60
+++ setup.c 20 Aug 2016 12:39:19 -0000
@@ -103,7 +103,8 @@ setup(char *dev)
setcdevname(rdevname, dev, preen);
if (!hotroot())
- if (pledge("stdio rpath wpath getpw disklabel", NULL)
== -1)
+ if (pledge("stdio rpath wpath getpw tty disklabel",
+ NULL) == -1)
err(1, "pledge");
}
if (fstat(fsreadfd, &statb) < 0) {
@@ -146,8 +147,13 @@ setup(char *dev)
if (!hotroot()) {
#ifndef SMALL
- if (pledge("stdio getpw", NULL) == -1)
- err(1, "pledge");
+ if (strcmp("fsdb", getprogname()) == 0) {
+ if (pledge("stdio rpath getpw tty", NULL) == -1)
+ err(1, "pledge");
+ } else {
+ if (pledge("stdio getpw", NULL) == -1)
+ err(1, "pledge");
+ }
#else
if (pledge("stdio", NULL) == -1)
err(1, "pledge");