Skip to contentSkip to conversation

gfs2-utils "make install" failure and fix

Cluster-devel New Jim Meyering 3 participants 7 messages Jun 29, 2009 – Aug 5, 2009

lore
Share & tools
lore
#0 lore raw

With an explicit --prefix, "make install" would install into /sbin regardless:

  $ ./configure --prefix=/p/p/coro
  ...
  $ make install
  make[1]: Entering directory `/h/meyering/w/co/gfs2-utils/gfs2/mkfs'
  /p/bin/install -c -d /sbin
  make[1]: Nothing to be done for `install-data-am'.
  /p/bin/install -c -m 755 mkfs.gfs2 /sbin
  /p/bin/install: cannot create regular file `/sbin/mkfs.gfs2': Permission denied
  make[1]: *** [install-exec-local] Error 1
  make[1]: Leaving directory `/h/meyering/w/co/gfs2-utils/gfs2/mkfs'
  make: *** [install-am] Error 2

Along the way I noticed the Makefile.am files
were using noinst_PROGRAMS and adding their own install rules. It's easier/cleaner/etc. to use sbin_PROGRAMS. Here's the patch:

From d794b4e7948741f5d6767970a2fde2c5fce15947 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 29 Jun 2009 11:23:09 +0200
Subject: [PATCH gfs2-utils] Use automake's sbin_PROGRAMS, rather than writing our own rules.

This also fixes a "make install" failure to honor --prefix.
* gfs2/mount/Makefile.am (sbin_PROGRAMS): Use sbin_PROGRAMS, not noinst_PROGRAMS.
(install-exec-local, uninstall-local): Remove rules. Automake automates this when you define sbin_PROGRAMS.
* gfs2/fsck/Makefile.am (sbin_PROGRAMS): Likewise. (install-exec-local, uninstall-local): Remove rules.
* gfs2/mkfs/Makefile.am (sbin_PROGRAMS): Likewise. (install-exec-local, uninstall-local): Remove rules. (install-exec-hook, uninstall-hook): Remove unnecessary sub-shells.

---
 gfs2/fsck/Makefile.am  |   10 +---------
 gfs2/mkfs/Makefile.am  |   16 ++++------------
 gfs2/mount/Makefile.am |   10 +---------
 3 files changed, 6 insertions(+), 30 deletions(-)
gfs2/fsck/Makefile.am +1 -9
index 15a5b1d..1667df3 100644
@@ -1,6 +1,6 @@
 MAINTAINERCLEANFILES	= Makefile.in
 
-noinst_PROGRAMS		= fsck.gfs2
+sbin_PROGRAMS		= fsck.gfs2
 
 noinst_HEADERS		= eattr.h fs_bits.h fsck.h fs_recovery.h hash.h \
 			  inode_hash.h link.h lost_n_found.h metawalk.h util.h
@@ -15,11 +15,3 @@ fsck_gfs2_CPPFLAGS	= -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM \
 			  -I$(top_srcdir)/gfs2/libgfs2
 
 fsck_gfs2_LDADD		= $(top_builddir)/gfs2/libgfs2/libgfs2.la
-
-install-exec-local:
-	$(INSTALL) -d $(DESTDIR)/sbin
-	$(INSTALL) -m 755 fsck.gfs2 $(DESTDIR)/sbin
-
-uninstall-local:
-	cd $(DESTDIR)/sbin && \
-		rm -f fsck.gfs2
gfs2/mkfs/Makefile.am +4 -12
index 9f156ba..ba4f851 100644
@@ -1,6 +1,6 @@
 MAINTAINERCLEANFILES	= Makefile.in
 
-noinst_PROGRAMS		= mkfs.gfs2
+sbin_PROGRAMS		= mkfs.gfs2
 
 noinst_HEADERS		= gfs2_mkfs.h
 
@@ -15,20 +15,12 @@ mkfs_gfs2_LDADD		= $(top_builddir)/gfs2/libgfs2/libgfs2.la
 
 relative_sbin		= $(shell perl -MFile::Spec -le 'print File::Spec->abs2rel("/sbin", "$(sbindir)")')
 
-install-exec-local:
-	$(INSTALL) -d $(DESTDIR)/sbin
-	$(INSTALL) -m 755 mkfs.gfs2 $(DESTDIR)/sbin
-
-uninstall-local:
-	cd $(DESTDIR)/sbin && \
-		rm -f mkfs.gfs2
-
 install-exec-hook:
 	$(INSTALL) -d $(DESTDIR)/$(sbindir)
-	(cd $(DESTDIR)/$(sbindir) && \
+	cd $(DESTDIR)/$(sbindir) && \
 		rm -f gfs2_grow gfs2_jadd && \
 		$(LN_S) $(relative_sbin)/mkfs.gfs2 gfs2_grow && \
-		$(LN_S) $(relative_sbin)/mkfs.gfs2 gfs2_jadd)
+		$(LN_S) $(relative_sbin)/mkfs.gfs2 gfs2_jadd
 
 uninstall-hook:
-	(cd $(DESTDIR)/$(sbindir) && rm -f gfs2_jadd gfs2_grow)
+	cd $(DESTDIR)/$(sbindir) && rm -f gfs2_jadd gfs2_grow
gfs2/mount/Makefile.am +1 -9
index fd927b6..a82970e 100644
@@ -1,6 +1,6 @@
 MAINTAINERCLEANFILES	= Makefile.in
 
-noinst_PROGRAMS		= mount.gfs2
+sbin_PROGRAMS		= mount.gfs2
 
 noinst_HEADERS		= gfs_ondisk.h util.h
 
@@ -12,11 +12,3 @@ mount_gfs2_CPPFLAGS	= -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM \
 			  -I$(top_srcdir)/group/libgfscontrol
 
 mount_gfs2_LDADD	= $(top_builddir)/group/libgfscontrol/libgfscontrol.la
-
-install-exec-local:
-	$(INSTALL) -d $(DESTDIR)/sbin
-	$(INSTALL) -m 755 mount.gfs2 $(DESTDIR)/sbin
-
-uninstall-local:
-	cd $(DESTDIR)/sbin && \
-		rm -f mount.gfs2

--
1.6.3.3.420.gd4b46

#1 lore raw

Hi Jim,

Quoted 34 lines · Jim Meyering

With an explicit --prefix, "make install" would install into /sbin regardless:

  $ ./configure --prefix=/p/p/coro
  ...
  $ make install
  make[1]: Entering directory `/h/meyering/w/co/gfs2-utils/gfs2/mkfs'
  /p/bin/install -c -d /sbin
  make[1]: Nothing to be done for `install-data-am'.
  /p/bin/install -c -m 755 mkfs.gfs2 /sbin
  /p/bin/install: cannot create regular file `/sbin/mkfs.gfs2': Permission denied
  make[1]: *** [install-exec-local] Error 1
  make[1]: Leaving directory `/h/meyering/w/co/gfs2-utils/gfs2/mkfs'
  make: *** [install-am] Error 2

Along the way I noticed the Makefile.am files
were using noinst_PROGRAMS and adding their own install rules. It's easier/cleaner/etc. to use sbin_PROGRAMS. Here's the patch:

Quoted 1 line

From d794b4e7948741f5d6767970a2fde2c5fce15947 Mon Sep 17 00:00:00 2001

From: Jim Meyering <[email protected]>
Date: Mon, 29 Jun 2009 11:23:09 +0200
Subject: [PATCH gfs2-utils] Use automake's sbin_PROGRAMS, rather than writing our own rules.

This also fixes a "make install" failure to honor --prefix.
* gfs2/mount/Makefile.am (sbin_PROGRAMS): Use sbin_PROGRAMS, not noinst_PROGRAMS.
(install-exec-local, uninstall-local): Remove rules. Automake automates this when you define sbin_PROGRAMS.
* gfs2/fsck/Makefile.am (sbin_PROGRAMS): Likewise. (install-exec-local, uninstall-local): Remove rules.
* gfs2/mkfs/Makefile.am (sbin_PROGRAMS): Likewise. (install-exec-local, uninstall-local): Remove rules. (install-exec-hook, uninstall-hook): Remove unnecessary sub-shells.

Quoted 5 lines
---
 gfs2/fsck/Makefile.am  |   10 +---------
 gfs2/mkfs/Makefile.am  |   16 ++++------------
 gfs2/mount/Makefile.am |   10 +---------
 3 files changed, 6 insertions(+), 30 deletions(-)

This is the same problem we discussed in another occasion (can't remember which one).

Those 3 binaries need to go in /sbin. mount(8) looks for mount helpers only in /sbin. Without the helper we fail to mount gfs2 or /usr could be on a gfs2 filesystem.. chicken egg?

sbin_PROGRAM will install them in /usr/sbin that is not correct (in the default case of course). All distro ship fsck* and mkfs* also in /sbin in order to check the filesystem (without /usr mounted) or reformat (same reason).

Handling of prefix can be better I agree, but turning them into sbin_PROGRAM doesn't work either.

Clearly I am open to any better solution than the one I have in place...

Fabio

#2 lore raw
Quoted 53 lines · Fabio M. Di Nitto
Quoted 34 lines · Jim Meyering

With an explicit --prefix, "make install" would install into /sbin regardless:

  $ ./configure --prefix=/p/p/coro
  ...
  $ make install
  make[1]: Entering directory `/h/meyering/w/co/gfs2-utils/gfs2/mkfs'
  /p/bin/install -c -d /sbin
  make[1]: Nothing to be done for `install-data-am'.
  /p/bin/install -c -m 755 mkfs.gfs2 /sbin
  /p/bin/install: cannot create regular file `/sbin/mkfs.gfs2': Permission denied
  make[1]: *** [install-exec-local] Error 1
  make[1]: Leaving directory `/h/meyering/w/co/gfs2-utils/gfs2/mkfs'
  make: *** [install-am] Error 2

Along the way I noticed the Makefile.am files
were using noinst_PROGRAMS and adding their own install rules. It's easier/cleaner/etc. to use sbin_PROGRAMS. Here's the patch:

Quoted 1 line

From d794b4e7948741f5d6767970a2fde2c5fce15947 Mon Sep 17 00:00:00 2001

From: Jim Meyering <[email protected]>
Date: Mon, 29 Jun 2009 11:23:09 +0200
Subject: [PATCH gfs2-utils] Use automake's sbin_PROGRAMS, rather than writing our own rules.

This also fixes a "make install" failure to honor --prefix.
* gfs2/mount/Makefile.am (sbin_PROGRAMS): Use sbin_PROGRAMS, not noinst_PROGRAMS.
(install-exec-local, uninstall-local): Remove rules. Automake automates this when you define sbin_PROGRAMS.
* gfs2/fsck/Makefile.am (sbin_PROGRAMS): Likewise. (install-exec-local, uninstall-local): Remove rules.
* gfs2/mkfs/Makefile.am (sbin_PROGRAMS): Likewise. (install-exec-local, uninstall-local): Remove rules. (install-exec-hook, uninstall-hook): Remove unnecessary sub-shells.

Quoted 5 lines
---
 gfs2/fsck/Makefile.am  |   10 +---------
 gfs2/mkfs/Makefile.am  |   16 ++++------------
 gfs2/mount/Makefile.am |   10 +---------
 3 files changed, 6 insertions(+), 30 deletions(-)

This is the same problem we discussed in another occasion (can't remember which one).

Those 3 binaries need to go in /sbin. mount(8) looks for mount helpers only in /sbin. Without the helper we fail to mount gfs2 or /usr could be on a gfs2 filesystem.. chicken egg?

sbin_PROGRAM will install them in /usr/sbin that is not correct (in the default case of course). All distro ship fsck* and mkfs* also in /sbin in order to check the filesystem (without /usr mounted) or reformat (same reason).

Quoted 4 lines

Handling of prefix can be better I agree, but turning them into sbin_PROGRAM doesn't work either.

Clearly I am open to any better solution than the one I have in place...

Sure.
There's already so much default-munging going on in configure.ac, why not add a tiny bit more.

This incremental patch does what you seem to want:

In case we're using the default (/usr) prefix and the default exec_prefix, and set sbindir to /sbin:

configure.ac +1 -0
index a568463..ca0301e 100644
@@ -38,6 +38,7 @@ fi
 
 case $exec_prefix in
   NONE)   exec_prefix=$prefix;;
+          test "$prefix:$sbindir" = '/usr:${exec_prefix}/sbin' && sbindir=/sbin
   prefix) exec_prefix=$prefix;;
 esac
 
#3 lore raw
Quoted 73 lines · Jim Meyering
Quoted 53 lines · Fabio M. Di Nitto
Quoted 34 lines · Jim Meyering

With an explicit --prefix, "make install" would install into /sbin regardless:

  $ ./configure --prefix=/p/p/coro
  ...
  $ make install
  make[1]: Entering directory `/h/meyering/w/co/gfs2-utils/gfs2/mkfs'
  /p/bin/install -c -d /sbin
  make[1]: Nothing to be done for `install-data-am'.
  /p/bin/install -c -m 755 mkfs.gfs2 /sbin
  /p/bin/install: cannot create regular file `/sbin/mkfs.gfs2': Permission denied
  make[1]: *** [install-exec-local] Error 1
  make[1]: Leaving directory `/h/meyering/w/co/gfs2-utils/gfs2/mkfs'
  make: *** [install-am] Error 2

Along the way I noticed the Makefile.am files
were using noinst_PROGRAMS and adding their own install rules. It's easier/cleaner/etc. to use sbin_PROGRAMS. Here's the patch:

Quoted 1 line

From d794b4e7948741f5d6767970a2fde2c5fce15947 Mon Sep 17 00:00:00 2001

From: Jim Meyering <[email protected]>
Date: Mon, 29 Jun 2009 11:23:09 +0200
Subject: [PATCH gfs2-utils] Use automake's sbin_PROGRAMS, rather than writing our own rules.

This also fixes a "make install" failure to honor --prefix.
* gfs2/mount/Makefile.am (sbin_PROGRAMS): Use sbin_PROGRAMS, not noinst_PROGRAMS.
(install-exec-local, uninstall-local): Remove rules. Automake automates this when you define sbin_PROGRAMS.
* gfs2/fsck/Makefile.am (sbin_PROGRAMS): Likewise. (install-exec-local, uninstall-local): Remove rules.
* gfs2/mkfs/Makefile.am (sbin_PROGRAMS): Likewise. (install-exec-local, uninstall-local): Remove rules. (install-exec-hook, uninstall-hook): Remove unnecessary sub-shells.

Quoted 5 lines
---
 gfs2/fsck/Makefile.am  |   10 +---------
 gfs2/mkfs/Makefile.am  |   16 ++++------------
 gfs2/mount/Makefile.am |   10 +---------
 3 files changed, 6 insertions(+), 30 deletions(-)

This is the same problem we discussed in another occasion (can't remember which one).

Those 3 binaries need to go in /sbin. mount(8) looks for mount helpers only in /sbin. Without the helper we fail to mount gfs2 or /usr could be on a gfs2 filesystem.. chicken egg?

sbin_PROGRAM will install them in /usr/sbin that is not correct (in the default case of course). All distro ship fsck* and mkfs* also in /sbin in order to check the filesystem (without /usr mounted) or reformat (same reason).

Quoted 4 lines

Handling of prefix can be better I agree, but turning them into sbin_PROGRAM doesn't work either.

Clearly I am open to any better solution than the one I have in place...

Sure.
There's already so much default-munging going on in configure.ac, why not add a tiny bit more.

This incremental patch does what you seem to want:

In case we're using the default (/usr) prefix and the default exec_prefix, and set sbindir to /sbin:

configure.ac +0 -0
index a568463..ca0301e 100644

configure.ac fi · line 43

Quoted 6 lines
configure.ac +1 -0
@@ -38,6 +38,7 @@ fi
 
 case $exec_prefix in
   NONE)   exec_prefix=$prefix;;
+          test "$prefix:$sbindir" = '/usr:${exec_prefix}/sbin' && sbindir=/sbin
   prefix) exec_prefix=$prefix;;
 esac

hmmmm... wouldn't that move all sbin_PROGRAMS to /sbin (assuming we are doing default build)? If so that's still not ideal because except those 3 binaries, all the others can go (and should go) in /usr/sbin as they are not vital for the FS operations.

I am sorry to play the devil advocate here....

Fabio

#4 lore raw

Fabio M. Di Nitto wrote:
...

Quoted 20 lines
Quoted 20 lines
Quoted 4 lines

Handling of prefix can be better I agree, but turning them into sbin_PROGRAM doesn't work either.

Clearly I am open to any better solution than the one I have in place...

Sure.
There's already so much default-munging going on in configure.ac, why not add a tiny bit more.

This incremental patch does what you seem to want:

In case we're using the default (/usr) prefix and the default exec_prefix, and set sbindir to /sbin:

configure.ac +0 -0
index a568463..ca0301e 100644
@@ -38,6 +38,7 @@ fi
 
Quoted 10 lines

configure.ac fi · line 43

Quoted 5 lines
configure.ac +1 -0
 case $exec_prefix in
   NONE)   exec_prefix=$prefix;;
+          test "$prefix:$sbindir" = '/usr:${exec_prefix}/sbin' && sbindir=/sbin
   prefix) exec_prefix=$prefix;;
 esac

hmmmm... wouldn't that move all sbin_PROGRAMS to /sbin (assuming we are doing default build)? If so that's still not ideal because except those 3 binaries, all the others can go (and should go) in /usr/sbin as they are not vital for the FS operations.

Good catch. I see, now.

The following incremental patch finally seems to do the right thing:

- with --prefix=P where P!=/usr: no change
- with no --prefix option, or with --prefix=/usr, install those three subdirs' tools into /sbin rather than into /usr/sbin.

gfs2/fsck/Makefile.am +5 -0
index 1667df3..ac89524 100644
@@ -1,5 +1,10 @@
 MAINTAINERCLEANFILES	= Makefile.in
 
+# install into /sbin, not /usr/sbin
+sbindir := $(shell test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
+	     && echo /sbin \
+	     || echo '$(exec_prefix)/sbin')
+
 sbin_PROGRAMS		= fsck.gfs2
 
 noinst_HEADERS		= eattr.h fs_bits.h fsck.h fs_recovery.h hash.h \
gfs2/mkfs/Makefile.am +5 -0
index ba4f851..75466fa 100644
@@ -1,5 +1,10 @@
 MAINTAINERCLEANFILES	= Makefile.in
 
+# install into /sbin, not /usr/sbin
+sbindir := $(shell test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
+	     && echo /sbin \
+	     || echo '$(exec_prefix)/sbin')
+
 sbin_PROGRAMS		= mkfs.gfs2
 
 noinst_HEADERS		= gfs2_mkfs.h
gfs2/mount/Makefile.am +5 -0
index a82970e..0303b24 100644
@@ -1,5 +1,10 @@
 MAINTAINERCLEANFILES	= Makefile.in
 
+# install into /sbin, not /usr/sbin
+sbindir := $(shell test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
+	     && echo /sbin \
+	     || echo '$(exec_prefix)/sbin')
+
 sbin_PROGRAMS		= mount.gfs2
 
 noinst_HEADERS		= gfs_ondisk.h util.h
#5 lore raw
Quoted 33 lines · Jim Meyering

Fabio M. Di Nitto wrote:
...

Quoted 20 lines
Quoted 20 lines
Quoted 4 lines

Handling of prefix can be better I agree, but turning them into sbin_PROGRAM doesn't work either.

Clearly I am open to any better solution than the one I have in place...

Sure.
There's already so much default-munging going on in configure.ac, why not add a tiny bit more.

This incremental patch does what you seem to want:

In case we're using the default (/usr) prefix and the default exec_prefix, and set sbindir to /sbin:

configure.ac +0 -0
index a568463..ca0301e 100644
@@ -38,6 +38,7 @@ fi
 
Quoted 10 lines

configure.ac fi · line 43

Quoted 5 lines
configure.ac +1 -0
 case $exec_prefix in
   NONE)   exec_prefix=$prefix;;
+          test "$prefix:$sbindir" = '/usr:${exec_prefix}/sbin' && sbindir=/sbin
   prefix) exec_prefix=$prefix;;
 esac

hmmmm... wouldn't that move all sbin_PROGRAMS to /sbin (assuming we are doing default build)? If so that's still not ideal because except those 3 binaries, all the others can go (and should go) in /usr/sbin as they are not vital for the FS operations.

Quoted 7 lines

Good catch. I see, now.

The following incremental patch finally seems to do the right thing:

- with --prefix=P where P!=/usr: no change
- with no --prefix option, or with --prefix=/usr, install those three subdirs' tools into /sbin rather than into /usr/sbin.

push at will ;)

Thanks!
Fabio

#6 lore raw

PATCH 1/1 remove description for non existed option in man page

In reply to Jim Meyering

Hi,

During learning Cluster through man page, I found a description for non existed option in man page, group_tool.8.

group_tool is not a daemon therefore -D is not meaningful.

The man page doesn't tell about -n option but I don't provide a patch for -n because I have not understood it.

Masatake YAMATO

git diff |cat

group/man/group_tool.8 +0 -3
index 6cf5e7f..b03b76e 100644
@@ -43,9 +43,6 @@ prints the posix locks on the named gfs fs from gfs_controld.
 \fB-v\fP
 Verbose output, used with the 'ls' subcommand.
 .TP
-\fB-D\fP
-Run the daemon in the foreground and print debug statements to stdout.
-.TP
 \fB-V\fP
 Print the version information and exit.
 .TP