File:
[cvs.NetBSD.org] /
pkgsrc /
filesystems /
fuse-archivemount /
patches /
patch-archivemount.c
Revision
1.1:
download - view:
text,
annotated -
select for diffs
Tue Nov 30 17:13:14 2021 UTC (3 years, 2 months ago) by
pho
Branches:
MAIN
CVS tags:
pkgsrc-2024Q4-base,
pkgsrc-2024Q4,
pkgsrc-2024Q3-base,
pkgsrc-2024Q3,
pkgsrc-2024Q2-base,
pkgsrc-2024Q2,
pkgsrc-2024Q1-base,
pkgsrc-2024Q1,
pkgsrc-2023Q4-base,
pkgsrc-2023Q4,
pkgsrc-2023Q3-base,
pkgsrc-2023Q3,
pkgsrc-2023Q2-base,
pkgsrc-2023Q2,
pkgsrc-2023Q1-base,
pkgsrc-2023Q1,
pkgsrc-2022Q4-base,
pkgsrc-2022Q4,
pkgsrc-2022Q3-base,
pkgsrc-2022Q3,
pkgsrc-2022Q2-base,
pkgsrc-2022Q2,
pkgsrc-2022Q1-base,
pkgsrc-2022Q1,
pkgsrc-2021Q4-base,
pkgsrc-2021Q4,
HEAD
Update to archivemount-0.9.1
* 0.9.1 - Incorporated fixes for compilation problems with newer gcc
versions. Contributed by Niels de Vos
* 0.9.0 - Make sure the written archive's format is the same or as
close as possible to the original. Due to a bug written files
were always in ustar format. Contributed by Jeff Ebert.
- Add AM_PROG_CC_C_O macro to configure.ac, contributed by
Jeff Ebert
- added option -o password, contributed by Scott Worley
- Pass REG_ENHANCED to regcomp where available (Mac and BSD).
Otherwise \? has no special meaning. Contributed by Michael
J. Walsh
- Removed magic number for block size, it's a constant now.
Contributed by John Delgado
* 0.8.12 - changed naming scheme of temporary files to avoid running
into too long names for the filesystem in /tmp
- fixed renaming a newly created file (it got saved under its
original name)
- activated code for creating symlinks; in old versions, symlinks
were not saved, presumably due to a bug in libarchive, but it
seems to work now.
* 0.8.11 - fixed accidentally broken renaming of files
* 0.8.10 - fixed renaming of directories, it did not work at all anymore
* 0.8.9 - fixed wrong insert into tree when a subdir had the same name as its
parent dir
* 0.8.8 - fixed bug when creating a new file and moving it over an old one,
happens e.g. when saving a file from the geany editor
* 0.8.7 - contribution by KAICHO:
* fixup to 0.8.6: corrected an ifdef
* 0.8.6 - contribution by KAICHO:
* adaptions for CentOS, RHEL and Scientific Linux
* 0.8.5 - fixed stat'ing of hardlinks in ar_readdir
- contributions by Alain Parmentier:
* FormatRaw optimization
* bugfix : use of off_t to support 64bits
* 0.8.4 - added option -o formatraw for readonly support of the FormatRaw
archive files supported by libarchive (kudos to Lee Leahu)
- bugfix: do not do the fuse mount when the archive cannot be read
(also kudos to Lee Leahu)
* 0.8.3 - do not call fuse_main anymore
- force fuse into single-threaded mode due to libarchive not being
thread-safe
Both patches contributed by Timothy Hobbs <timothyhobbs@seznam.cz>,
who found them in the Fedora RPM.
* 0.8.2 - added nosave option, contributed by
Timothy Hobbs <timothyhobbs@seznam.cz>
* 0.8.1 - added missing header file
* 0.8.0 - contributions by Tomáš Čech <sleep_walker@suse.cz>:
* Allow mounting only subtree of archive, strip common part of
path in that case.
* 0.7.0 - contributions by Andrew Brampton:
* simplifications in the code
* speedup by using hashes
* 0.6.2 - contributions by Niels de Vos:
* exchanged posix_rwlocks against mutexes to finally get rid of
the crashes
* replaced some accidental indentations with space against proper tabs
* 0.6.1 - clarified licensing issue (thanks to Niels de Vos for pointing it out)
* 0.6.0 - contributions by Thomas J. Duck:
* autoconf/automake support
* bug reports and fixes for mac-fuse
many thanks for this!
$NetBSD: patch-archivemount.c,v 1.1 2021/11/30 17:13:14 pho Exp $
Hunk #0:
On NetBSD there's no <fuse/fuse_lowlevel.h>. The file has to be
#include'd as <fuse_lowlevel.h>.
Hunk #1:
Original comment:
> date: 2007-02-21 09:04:30 +0900; author: pooka; state: Exp; lines: +33 -3;
> use open(2) instead of mknod(2) to create regular files. while
> the latter works on the most current NetBSD, I don't feel like running
> file systems unnecessarily as the superuser
But pho@ thinks it doesn't really make any difference, at least on
NetBSD, because NetBSD librefuse doesn't support non-root mounting
(via setuid'ed fusermount) and therefore running filesystems as root
is the only option. Of course filesystems can drop their root
privilege after calling fuse_mount(), but nobody actually does that.
Hunk #2, #3:
If fuse_main() is available, use it. There's no need to reimplement
its functionality, especially since this reimplementation isn't
API-compatible with NetBSD librefuse.
--- archivemount.c.orig 2020-04-20 11:27:10.000000000 +0000
+++ archivemount.c
@@ -29,7 +29,11 @@
#include "config.h"
#include <fuse.h>
-#include <fuse/fuse_lowlevel.h>
+#if defined(HAVE_FUSE_FUSE_LOWLEVEL_H)
+# include <fuse/fuse_lowlevel.h>
+#elif defined(HAVE_FUSE_LOWLEVEL_H)
+# include <fuse_lowlevel.h>
+#endif
#include <fuse_opt.h>
#include <stdio.h>
#include <stdlib.h>
@@ -2224,12 +2228,26 @@ ar_mknod(const char *path, mode_t mode,
return tmp;
}
/* create temp file */
- if (mknod(location, mode, rdev) == -1) {
- log("Could not create temporary file %s: %s",
- location, strerror(errno));
- free(location);
- pthread_mutex_unlock(&lock);
- return 0 - errno;
+ if (S_ISREG(mode)) {
+ int fd = open(location, O_WRONLY | O_CREAT | O_EXCL, mode);
+
+ if (fd == -1) {
+ log("Could not create temporary file %s: %s",
+ location, strerror(errno));
+ free(location);
+ pthread_mutex_unlock(&lock);
+ return 0 - errno;
+ }
+ close(fd);
+ }
+ else {
+ if (mknod(location, mode, rdev) == -1) {
+ log("Could not create temporary file %s: %s",
+ location, strerror(errno));
+ free(location);
+ pthread_mutex_unlock(&lock);
+ return 0 - errno;
+ }
}
/* build node */
if ((node = init_node()) == NULL) {
@@ -2912,7 +2930,7 @@ main(int argc, char **argv)
*/
fuse_opt_add_arg(&args, "-s");
-#if FUSE_VERSION >= 26
+#if defined(HAVE_FUSE_CHAN_FD)
{
struct fuse *fuse;
struct fuse_chan *ch;
@@ -2974,13 +2992,13 @@ main(int argc, char **argv)
fuse_destroy(fuse);
free(mountpoint);
}
-#else
+#else /* defined(HAVE_FUSE_CHAN_FD) */
{
/* now do the real mount */
int fuse_ret;
fuse_ret = fuse_main(args.argc, args.argv, &ar_oper, NULL);
}
-#endif
+#endif /* defined(HAVE_FUSE_CHAN_FD) */
/* go back to saved dir */
{
CVSweb <webmaster@jp.NetBSD.org>