Hello community, here is the log from the commit of package bindfs for openSUSE:Factory checked in at 2020-09-03 01:08:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/bindfs (Old) and /work/SRC/openSUSE:Factory/.bindfs.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "bindfs" Thu Sep 3 01:08:56 2020 rev:20 rq:829652 version:1.14.7 Changes: -------- --- /work/SRC/openSUSE:Factory/bindfs/bindfs.changes 2020-01-12 23:17:00.506652457 +0100 +++ /work/SRC/openSUSE:Factory/.bindfs.new.3399/bindfs.changes 2020-09-03 01:09:21.748371152 +0200 @@ -1,0 +2,6 @@ +Wed Aug 26 00:10:03 UTC 2020 - Jan Engelhardt <[email protected]> + +- Update to release 1.14.7 + * Added --map-passwd and --map-group + +------------------------------------------------------------------- Old: ---- bindfs-1.14.3.tar.gz New: ---- bindfs-1.14.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ bindfs.spec ++++++ --- /var/tmp/diff_new_pack.HpoApX/_old 2020-09-03 01:09:23.448371719 +0200 +++ /var/tmp/diff_new_pack.HpoApX/_new 2020-09-03 01:09:23.452371721 +0200 @@ -17,7 +17,7 @@ Name: bindfs -Version: 1.14.3 +Version: 1.14.7 Release: 0 Summary: Filesystem for mapping directories with alternate permissions License: GPL-2.0-or-later ++++++ bindfs-1.14.3.tar.gz -> bindfs-1.14.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/ChangeLog new/bindfs-1.14.7/ChangeLog --- old/bindfs-1.14.3/ChangeLog 2020-01-08 11:37:31.000000000 +0100 +++ new/bindfs-1.14.7/ChangeLog 2020-05-13 19:39:26.000000000 +0200 @@ -1,3 +1,28 @@ +2020-05-13 Martin Pärtel <martin dot partel at gmail dot com> + + * Fixed missing newlines bug with --map-passwd and --map-group + (my fault). + * Released 1.14.7 + +2020-05-10 Martin Pärtel <martin dot partel at gmail dot com> + + * Added --map-passwd and --map-group (PR #85 by Cybso@, thanks!) + * Released 1.14.6 + +2020-04-13 Martin Pärtel <martin dot partel at gmail dot com> + + * Fixed tests with Ruby 2.7.1 or newer. + * Released 1.14.5 + +2020-03-22 Martin Pärtel <martin dot partel at gmail dot com> + + * Defined _DARWIN_BETTER_REALPATH to get a non-broken realpath() on Catalina (issue #83). + * Released 1.14.4 + +2020-02-12 Martin Pärtel <martin dot partel at gmail dot com> + + * Added --fuse-version. + 2020-01-08 Martin Pärtel <martin dot partel at gmail dot com> * Fixed build with -fno-common, which is the default in GCC 10 (PR #81, thanks jengelh@!). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/README.md new/bindfs-1.14.7/README.md --- old/bindfs-1.14.3/README.md 2020-01-08 11:37:31.000000000 +0100 +++ new/bindfs-1.14.7/README.md 2020-05-13 19:39:26.000000000 +0200 @@ -21,6 +21,7 @@ ## Installation ## Make sure FUSE 2.6.0 or above is installed (https://github.com/libfuse/libfuse). +FUSE 3 is not yet supported. Download a [release](https://bindfs.org/downloads/) or clone this repository. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/configure new/bindfs-1.14.7/configure --- old/bindfs-1.14.3/configure 2020-01-08 11:37:34.000000000 +0100 +++ new/bindfs-1.14.7/configure 2020-05-13 19:39:28.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for bindfs 1.14.3. +# Generated by GNU Autoconf 2.69 for bindfs 1.14.7. # # Report bugs to <[email protected]>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='bindfs' PACKAGE_TARNAME='bindfs' -PACKAGE_VERSION='1.14.3' -PACKAGE_STRING='bindfs 1.14.3' +PACKAGE_VERSION='1.14.7' +PACKAGE_STRING='bindfs 1.14.7' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='' @@ -1340,7 +1340,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bindfs 1.14.3 to adapt to many kinds of systems. +\`configure' configures bindfs 1.14.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1411,7 +1411,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bindfs 1.14.3:";; + short | recursive ) echo "Configuration of bindfs 1.14.7:";; esac cat <<\_ACEOF @@ -1531,7 +1531,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bindfs configure 1.14.3 +bindfs configure 1.14.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1809,7 +1809,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bindfs $as_me 1.14.3, which was +It was created by bindfs $as_me 1.14.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2673,7 +2673,7 @@ # Define the identity of the package. PACKAGE='bindfs' - VERSION='1.14.3' + VERSION='1.14.7' cat >>confdefs.h <<_ACEOF @@ -12910,7 +12910,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bindfs $as_me 1.14.3, which was +This file was extended by bindfs $as_me 1.14.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12976,7 +12976,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bindfs config.status 1.14.3 +bindfs config.status 1.14.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/configure.ac new/bindfs-1.14.7/configure.ac --- old/bindfs-1.14.3/configure.ac 2020-01-08 11:37:31.000000000 +0100 +++ new/bindfs-1.14.7/configure.ac 2020-05-13 19:39:26.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([bindfs],[1.14.3],[[email protected]]) +AC_INIT([bindfs],[1.14.7],[[email protected]]) AM_INIT_AUTOMAKE([foreign serial-tests]) AC_CONFIG_HEADERS([config.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/src/bindfs.1 new/bindfs-1.14.7/src/bindfs.1 --- old/bindfs-1.14.3/src/bindfs.1 2020-01-08 11:37:31.000000000 +0100 +++ new/bindfs-1.14.7/src/bindfs.1 2020-05-13 19:39:26.000000000 +0200 @@ -66,6 +66,24 @@ the corresponding behavior of this option. Requires mounting as root. +.TP +.B \-\-map-passwd=\fI<passwdfile>\fP, \-o map-passwd=\fI<passwdfile>\fP +.PD 0 +.TP +.B \-\-map-group=\fI<groupfile>\fP, \-o map-group=\fI<groupfile>\fP +Like \fB--map=...\fP, but reads the UID/GID mapping from passwd and group +files (like \fI/etc/passwd\fP and \fI/etc/group\fP). Helpful to restore +system backups where UIDs/GIDs differ. + +Example usage: + +\& bindfs --map-passwd=/mnt/orig/etc/passwd \\ +.br +\& \--map-passwd=/mnt/orig/etc/group \\ +.br +\& /mnt/orig /mnt/mapped + +Requires mounting as root. .TP .B \-\-uid\-offset=..., \-o uid\-offset=... @@ -302,6 +320,10 @@ .B \-V, \-\-version Displays version information and exits. +.B \-\-fuse\-version +Displays the version of the FUSE library interface that was seen at compile-time, +as well as the version that bindfs currently runs with. + .TP .B \-\-no\-allow\-other, \-o no\-allow\-other Does not add \fB\-o allow_other\fP to FUSE options. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/src/bindfs.c new/bindfs-1.14.7/src/bindfs.c --- old/bindfs-1.14.3/src/bindfs.c 2020-01-08 11:37:31.000000000 +0100 +++ new/bindfs-1.14.7/src/bindfs.c 2020-05-13 19:39:26.000000000 +0200 @@ -42,6 +42,9 @@ /* The new non-deprecated version of _BSD_SOURCE */ #define _DEFAULT_SOURCE +/* Fix MacOS realpath() broken around Catalina (#83) */ +#define _DARWIN_BETTER_REALPATH + #include <stdlib.h> #include <stddef.h> #include <stdio.h> @@ -1533,6 +1536,7 @@ "Information:\n" " -h --help Print this and exit.\n" " -V --version Print version number and exit.\n" + " --fuse-version Print version of FUSE library.\n" "\n" "File ownership:\n" " -u --force-user=... Set file owner.\n" @@ -1542,6 +1546,8 @@ " -M --mirror-only=... Like --mirror but disallow access for\n" " all other users.\n" " --map=user1/user2:... Let user2 see files of user1 as his own.\n" + " --map-passwd=<passwdfile> Load uid mapping from <passwdfile>.\n" + " --map-group=<groupfile> Load gid mapping from <groupfile>.\n" " --uid-offset=... Set file uid = uid + offset.\n" " --gid-offset=... Set file gid = gid + offset.\n" "\n" @@ -1618,6 +1624,7 @@ OPTKEY_UNKNOWN = -1, OPTKEY_HELP, OPTKEY_VERSION, + OPTKEY_FUSE_VERSION, OPTKEY_CREATE_AS_USER, OPTKEY_CREATE_AS_MOUNTER, OPTKEY_CHOWN_NORMAL, @@ -1658,6 +1665,11 @@ printf("%s\n", PACKAGE_STRING); exit(0); + case OPTKEY_FUSE_VERSION: + printf("libfuse interface compile-time version %d.%d\n", FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION); + printf("libfuse interface linked version %d.%d\n", fuse_version() / 10, fuse_version() % 10); + exit(0); + case OPTKEY_CREATE_AS_USER: if (getuid() == 0) { settings.create_policy = CREATE_AS_USER; @@ -1833,6 +1845,107 @@ return 1; } +/* + * Reads a passwd or group file (like /etc/passwd and /etc/group) and + * adds all entries to the map. Useful for restoring backups + * where UIDs or GIDs differ. + */ +static int parse_map_file(UserMap *map, UserMap *reverse_map, char *file, int as_gid) +{ + int result = 0; + + FILE *fp = NULL; + size_t len = 0; + ssize_t read; + int lineno = 0; + char *column = NULL; + char *line = NULL; + + uid_t uid_from, uid_to; + UsermapStatus status; + + // Toggle between UID (passwd) and GID (group) + const int (*value_to_id)(const char *username, uid_t *ret); + const UsermapStatus (*usermap_add)(UserMap *map, uid_t from, uid_t to); + const char *label_name, *label_id; + if (as_gid) { + value_to_id = &group_gid; + usermap_add = &usermap_add_gid; + label_name = "group"; + label_id = "GID"; + } else { + value_to_id = &user_uid; + usermap_add = &usermap_add_uid; + label_name = "user"; + label_id = "UID"; + } + + fp = fopen(file, "r"); + if (fp == NULL) { + fprintf(stderr, "Failed to open file: %s\n", file); + goto exit; + } + + while ((read = getline(&line, &len, fp)) != -1) { + // Remove newline in case someone builds a file with lines like 'a:b:123' by hand. + // If we left the newline, strtok would return "123\n" as the last token. + if (read > 0 && line[read - 1] == '\n') { + line[read - 1] = '\0'; + } + + lineno++; + /* + * NAME::[GU]ID(:....) + * NAME = TO + * [GU]ID = FROM + */ + column = strtok(line, ":"); + if (column == NULL) { + fprintf(stderr, "Unexpected end of entry in %s on line %d\n", file, lineno); + goto exit; + } + if (!value_to_id(column, &uid_to)) { + fprintf(stderr, "Warning: Ignoring invalid %s in %s on line %d: '%s'\n", label_name, file, lineno, column); + continue; + } + + column = strtok(NULL, ":"); + if (column != NULL) { + // Skip second column + column = strtok(NULL, ":"); + } + if (column == NULL) { + fprintf(stderr, "Unexpected end of entry in %s on line %d\n", file, lineno); + goto exit; + } + if (!value_to_id(column, &uid_from)) { + fprintf(stderr, "Warning: Ignoring invalid %s in %s on line %d: '%s'\n", label_id, file, lineno, column); + continue; + } + + status = usermap_add(map, uid_from, uid_to); + if (status != 0) { + fprintf(stderr, "%s\n", usermap_errorstr(status)); + goto exit; + } + status = usermap_add(reverse_map, uid_to, uid_from); + if (status != 0) { + fprintf(stderr, "%s\n", usermap_errorstr(status)); + goto exit; + } + } + + result = 1; +exit: + if (line) { + free(line); + } + if (fp != NULL) { + fclose(fp); + } + return result; +} + static int parse_user_map(UserMap *map, UserMap *reverse_map, char *spec) { char *p = spec; @@ -2015,6 +2128,8 @@ char *mirror; char *mirror_only; char *map; + char *map_passwd; + char *map_group; char *read_rate; char *write_rate; char *create_for_user; @@ -2042,6 +2157,7 @@ static const struct fuse_opt options[] = { OPT2("-h", "--help", OPTKEY_HELP), OPT2("-V", "--version", OPTKEY_VERSION), + FUSE_OPT_KEY("--fuse-version", OPTKEY_FUSE_VERSION), OPT_OFFSET3("-u %s", "--force-user=%s", "force-user=%s", user, -1), OPT_OFFSET3("-g %s", "--force-group=%s", "force-group=%s", group, -1), @@ -2053,6 +2169,8 @@ OPT_OFFSET3("-m %s", "--mirror=%s", "mirror=%s", mirror, -1), OPT_OFFSET3("-M %s", "--mirror-only=%s", "mirror-only=%s", mirror_only, -1), OPT_OFFSET2("--map=%s", "map=%s", map, -1), + OPT_OFFSET2("--map-passwd=%s", "map-passwd=%s", map_passwd, -1), + OPT_OFFSET2("--map-group=%s", "map-group=%s", map_group, -1), OPT_OFFSET3("-n", "--no-allow-other", "no-allow-other", no_allow_other, -1), OPT_OFFSET2("--read-rate=%s", "read-rate=%s", read_rate, -1), @@ -2216,7 +2334,31 @@ } } - /* Parse usermap */ + /* Parse passwd */ + if (od.map_passwd) { + if (getuid() != 0) { + fprintf(stderr, "Error: You need to be root to use --map-passwd !\n"); + return 1; + } + if (!parse_map_file(settings.usermap, settings.usermap_reverse, od.map_passwd, 0)) { + /* parse_map_file printed an error */ + return 1; + } + } + + /* Parse group */ + if (od.map_group) { + if (getuid() != 0) { + fprintf(stderr, "Error: You need to be root to use --map-group !\n"); + return 1; + } + if (!parse_map_file(settings.usermap, settings.usermap_reverse, od.map_group, 1)) { + /* parse_map_file printed an error */ + return 1; + } + } + + /* Parse usermap (may overwrite values from --map-passwd and --map-group) */ if (od.map) { if (getuid() != 0) { fprintf(stderr, "Error: You need to be root to use --map !\n"); @@ -2393,8 +2535,9 @@ } /* If the mount source and destination directories are the same - then don't require that the directory be empty. */ - if (strcmp(settings.mntsrc, settings.mntdest) == 0) + then don't require that the directory be empty. + FUSE 3 removed support for -ononempty, allowing nonempty directories by default */ + if (strcmp(settings.mntsrc, settings.mntdest) == 0 && fuse_version() < 30) fuse_opt_add_arg(&args, "-ononempty"); /* Open mount source for chrooting in bindfs_init */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/src/userinfo.c new/bindfs-1.14.7/src/userinfo.c --- old/bindfs-1.14.3/src/userinfo.c 2020-01-08 11:37:31.000000000 +0100 +++ new/bindfs-1.14.7/src/userinfo.c 2020-05-13 19:39:26.000000000 +0200 @@ -106,13 +106,19 @@ uid_cache_size = 0; + setpwent(); + while (1) { errno = 0; pw = getpwent(); if (pw == NULL) { if (errno == 0) { break; + } else if (errno == ENOENT) { // We might have gotten some entries. This happens at least on the CentOS 8 Vagrant image (tested 2020-04-13). + fprintf(stderr, "Got ENOENT while rebuilding uid cache. The cache may be incomplete.\n"); + break; } else { + perror("Failed to rebuild uid cache"); goto error; } } @@ -134,7 +140,6 @@ error: endpwent(); clear_uid_cache(); - DPRINTF("Failed to rebuild uid cache"); return 0; } @@ -150,13 +155,19 @@ qsort(uid_cache, uid_cache_size, sizeof(struct uid_cache_entry), uid_cache_name_sortcmp); + setgrent(); + while (1) { errno = 0; gr = getgrent(); if (gr == NULL) { if (errno == 0) { break; + } else if (errno == ENOENT) { // We might have gotten some entries. This happens at least on the CentOS 8 Vagrant image (tested 2020-04-13). + fprintf(stderr, "Got ENOENT while rebuilding gid cache. The cache may be incomplete.\n"); + break; } else { + perror("Failed to rebuild gid cache"); goto error; } } @@ -190,7 +201,6 @@ error: endgrent(); clear_gid_cache(); - DPRINTF("Failed to rebuild uid cache"); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/tests/test_bindfs.rb new/bindfs-1.14.7/tests/test_bindfs.rb --- old/bindfs-1.14.3/tests/test_bindfs.rb 2020-01-08 11:37:31.000000000 +0100 +++ new/bindfs-1.14.7/tests/test_bindfs.rb 2020-05-13 19:39:26.000000000 +0200 @@ -23,6 +23,7 @@ require 'common.rb' require 'etc' +require 'tempfile' include Errno @@ -317,8 +318,11 @@ testenv("--rename-deny") do touch('src/file') mkdir('src/dir') - assert_exception(EPERM) { mv('mnt/file', 'mnt/file2') } - assert_exception(EPERM) { mv('mnt/dir', 'mnt/dir2') } + # We don't use FileUtils.mv because it was changed in Ruby 2.7.1 to + # fall back to copying on EPERM: + # https://github.com/ruby/ruby/commit/7d3d8e79fe9cc9f21cd4341f0a6fb2e6306688fd + assert_exception(EPERM) { File.rename('mnt/file', 'mnt/file2') } + assert_exception(EPERM) { File.rename('mnt/dir', 'mnt/dir2') } end root_testenv("--map=nobody/root:@#{nobody_group}/@#{root_group}") do @@ -392,6 +396,26 @@ assert { File.stat('mnt/file1').gid == 1 } end +Tempfile.create('passwdfile') do |passwd_file| + Tempfile.create('groupfile') do |group_file| + passwd_file.puts("nobody:x:123:456:,,,:/tmp:/bin/false") + passwd_file.flush + group_file.write("#{nobody_group}:x:789") + group_file.flush + root_testenv("--map-passwd=#{Shellwords.escape(passwd_file.path)} --map-group=#{Shellwords.escape(group_file.path)}") do + touch('src/file1') + chown(123, 789, 'src/file1') + assert { File.stat('mnt/file1').uid == nobody_uid } + assert { File.stat('mnt/file1').gid == nobody_gid } + + touch('src/file2') + chown(nobody_uid, nobody_gid, 'mnt/file2') + assert { File.stat('src/file2').uid == 123 } + assert { File.stat('src/file2').gid == 789 } + end + end +end + root_testenv("--uid-offset=2") do touch('src/file') chown(1, nil, 'src/file') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/vagrant/centos8/Vagrantfile new/bindfs-1.14.7/vagrant/centos8/Vagrantfile --- old/bindfs-1.14.3/vagrant/centos8/Vagrantfile 1970-01-01 01:00:00.000000000 +0100 +++ new/bindfs-1.14.7/vagrant/centos8/Vagrantfile 2020-05-13 19:39:26.000000000 +0200 @@ -0,0 +1,22 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "centos/8" + + config.vm.synced_folder ".", "/vagrant", disabled: true + config.vm.synced_folder "../../", "/bindfs", + type: "rsync", + rsync__auto: false, + rsync__exclude: ["vagrant"], + rsync__args: ["-av", "--delete-after"] + + config.vm.provider "virtualbox" do |v| + v.name = "bindfs-centos8" + end + + config.vm.provision "shell", inline: <<-SHELL + yum install -y fuse fuse-devel gcc make pkg-config ruby valgrind + echo user_allow_other > /etc/fuse.conf + SHELL +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bindfs-1.14.3/vagrant/test.rb new/bindfs-1.14.7/vagrant/test.rb --- old/bindfs-1.14.3/vagrant/test.rb 2020-01-08 11:37:31.000000000 +0100 +++ new/bindfs-1.14.7/vagrant/test.rb 2020-05-13 19:39:26.000000000 +0200 @@ -35,7 +35,7 @@ dirs = Dir.glob('*/Vagrantfile').map { |path| File.dirname(path) } unless specifically_selected_vms.empty? - dirs = dirs.select { |dir| ARGV.include?(dir) } + dirs = dirs.select { |dir| specifically_selected_vms.include?(dir) } end def with_retries(n, options = {}, &block)
