aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulio Merino <jmmv@meroh.net>2016-02-08 21:10:48 -0500
committerJulio Merino <jmmv@meroh.net>2016-02-08 21:10:48 -0500
commit9b4ca1aadefbb75ab4051e0b0e9173709456f7fb (patch)
treee7f4f74ed91779bdde639cc35a12a7ab27626334
parenta03d3eab39b265fb9fcb5287d81061e7957f355a (diff)
downloadsshfs-9b4ca1aadefbb75ab4051e0b0e9173709456f7fb.tar
sshfs-9b4ca1aadefbb75ab4051e0b0e9173709456f7fb.tar.gz
sshfs-9b4ca1aadefbb75ab4051e0b0e9173709456f7fb.tar.bz2
sshfs-9b4ca1aadefbb75ab4051e0b0e9173709456f7fb.zip
Avoid using cpp for sshfs.1 generation
Move the logic to determine which values to stick into the manual page to the configure script and replace the logic to build the sshfs.1 manual page with sed instead of abusing cpp. I'm not using AC_OUTPUT here because this macro is typically used to generate support build files. Final artifacts of the build should, in general, be built by the Makefile itself.
-rw-r--r--Makefile.am9
-rw-r--r--configure.ac11
-rw-r--r--sshfs.1.in18
-rw-r--r--sshfs.c23
4 files changed, 31 insertions, 30 deletions
diff --git a/Makefile.am b/Makefile.am
index ed3090e..f003bae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,7 +12,8 @@ endif
sshfs_LDADD = $(SSHFS_LIBS)
sshfs_CFLAGS = $(SSHFS_CFLAGS)
-sshfs_CPPFLAGS = -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"$(libdir)\"
+sshfs_CPPFLAGS = -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"$(libdir)\" \
+ -DIDMAP_DEFAULT="\"$(IDMAP_DEFAULT)\""
EXTRA_DIST = sshnodelay.c sshfs.1.in
CLEANFILES = sshnodelay.so sshfs.1 sshfs.1.tmp
@@ -20,8 +21,10 @@ CLEANFILES = sshnodelay.so sshfs.1 sshfs.1.tmp
dist_man_MANS = sshfs.1
sshfs.1: sshfs.1.in
- $(AM_V_GEN)$(CPP) $(CPPFLAGS) -P -xassembler-with-cpp sshfs.1.in \
- | sed -e '/^$$/d' >sshfs.1.tmp || exit 1; \
+ $(AM_V_GEN)sed \
+ -e 's,__IDMAP_DEFAULT__,$(IDMAP_DEFAULT),g' \
+ -e 's,__UNMOUNT_COMMAND__,$(UNMOUNT_COMMAND),g' \
+ <sshfs.1.in >sshfs.1.tmp || exit 1; \
mv sshfs.1.tmp sshfs.1
if SSH_NODELAY_SO
diff --git a/configure.ac b/configure.ac
index 7fdc36a..a91ec3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,5 +56,16 @@ fi
AM_CONDITIONAL(FUSE_OPT_COMPAT, test "$have_fuse_opt_parse" = no)
AM_CONDITIONAL(DARWIN_COMPAT, test "$osname" = darwin)
+AC_CHECK_PROG(UNMOUNT_COMMAND, fusermount, fusermount -u, umount)
+
+# TODO: Figure out why we special-case this in Darwin. Would be nice if
+# the default setting was consistent across platforms so we wouldn't need
+# to care about it here.
+case "$osname" in
+ darwin) IDMAP_DEFAULT=user ;;
+ *) IDMAP_DEFAULT=none ;;
+esac
+AC_SUBST(IDMAP_DEFAULT)
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/sshfs.1.in b/sshfs.1.in
index 7d431ed..fcf3e9f 100644
--- a/sshfs.1.in
+++ b/sshfs.1.in
@@ -7,11 +7,7 @@ SSHFS \- filesystem client based on ssh
\fBsshfs\fP [\fIuser\fP@]\fBhost\fP:[\fIdir\fP] \fBmountpoint\fP [\fIoptions\fP]
.SS unmounting
.TP
-#ifdef __APPLE__
-\fBumount mountpoint\fP
-#else
-\fBfusermount -u mountpoint\fP
-#endif
+\fB__UNMOUNT_COMMAND__ mountpoint\fP
.SH DESCRIPTION
SSHFS (Secure SHell FileSystem) is a file system for Linux (and other
operating systems with a FUSE implementation, such as Mac OS X or FreeBSD)
@@ -101,22 +97,14 @@ fix buffer fillup bug in server (default: on)
.RE
.TP
\fB\-o\fR idmap=TYPE
-user/group ID mapping, possible types are:
+user/group ID mapping (default: __IDMAP_DEFAULT__)
.RS 8
.TP
none
-#ifdef __APPLE__
no translation of the ID space
-#else
-no translation of the ID space (default)
-#endif
.TP
user
-#ifdef __APPLE__
-only translate UID/GID of connecting user (default)
-#else
-only translate UID of connecting user
-#endif
+only translate UID/GID of connecting user
.TP
file
translate UIDs/GIDs based upon the contents of \fBuidfile \fR and
diff --git a/sshfs.c b/sshfs.c
index 64c1d8c..6d5e083 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -3413,14 +3413,9 @@ static void usage(const char *progname)
" [no]nodelaysrv set nodelay tcp flag in sshd (default: off)\n"
" [no]truncate fix truncate for old servers (default: off)\n"
" [no]buflimit fix buffer fillup bug in server (default: on)\n"
-" -o idmap=TYPE user/group ID mapping, possible types are:\n"
-#ifdef __APPLE__
+" -o idmap=TYPE user/group ID mapping (default: " IDMAP_DEFAULT ")\n"
" none no translation of the ID space\n"
-" user only translate UID/GID of connecting user (default)\n"
-#else
-" none no translation of the ID space (default)\n"
-" user only translate UID of connecting user\n"
-#endif
+" user only translate UID/GID of connecting user\n"
" file translate UIDs/GIDs contained in uidfile/gidfile\n"
" -o uidfile=FILE file containing username:remote_uid mappings\n"
" -o gidfile=FILE file containing groupname:remote_gid mappings\n"
@@ -3975,11 +3970,15 @@ int main(int argc, char *argv[])
sshfs.delay_connect = 0;
sshfs.slave = 0;
sshfs.detect_uid = 0;
-#ifdef __APPLE__
- sshfs.idmap = IDMAP_USER;
-#else
- sshfs.idmap = IDMAP_NONE;
-#endif
+ if (strcmp(IDMAP_DEFAULT, "none") == 0) {
+ sshfs.idmap = IDMAP_NONE;
+ } else if (strcmp(IDMAP_DEFAULT, "user") == 0) {
+ sshfs.idmap = IDMAP_USER;
+ } else {
+ fprintf(stderr, "bad idmap default value built into sshfs; "
+ "assuming none (bad logic in configure script?)\n");
+ sshfs.idmap = IDMAP_NONE;
+ }
sshfs.nomap = NOMAP_ERROR;
ssh_add_arg("ssh");
ssh_add_arg("-x");