pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/filesystems/fuse-lzofs Fix a segfault on non-32bits pl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ed0eb77c7e6c
branches:  trunk
changeset: 371334:ed0eb77c7e6c
user:      pho <pho%pkgsrc.org@localhost>
date:      Sun Jan 09 15:14:39 2022 +0000

description:
Fix a segfault on non-32bits platforms

diffstat:

 filesystems/fuse-lzofs/Makefile         |    3 +-
 filesystems/fuse-lzofs/distinfo         |    4 +-
 filesystems/fuse-lzofs/patches/patch-ab |  121 ++++++++++---------------------
 3 files changed, 45 insertions(+), 83 deletions(-)

diffs (189 lines):

diff -r bc89684388eb -r ed0eb77c7e6c filesystems/fuse-lzofs/Makefile
--- a/filesystems/fuse-lzofs/Makefile   Sun Jan 09 14:41:05 2022 +0000
+++ b/filesystems/fuse-lzofs/Makefile   Sun Jan 09 15:14:39 2022 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.6 2021/05/14 14:17:41 nia Exp $
+# $NetBSD: Makefile,v 1.7 2022/01/09 15:14:39 pho Exp $
 #
 
 DISTNAME=      LZOlayer_fs-20060306
+PKGREVISION=   1
 PKGNAME=       fuse-${DISTNAME:S/LZOlayer_fs/lzofs/}
 CATEGORIES=    filesystems
 #MASTER_SITES= http://north.one.pl/~kazik/pub/LZOlayer/
diff -r bc89684388eb -r ed0eb77c7e6c filesystems/fuse-lzofs/distinfo
--- a/filesystems/fuse-lzofs/distinfo   Sun Jan 09 14:41:05 2022 +0000
+++ b/filesystems/fuse-lzofs/distinfo   Sun Jan 09 15:14:39 2022 +0000
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.7 2021/10/26 10:25:28 nia Exp $
+$NetBSD: distinfo,v 1.8 2022/01/09 15:14:39 pho Exp $
 
 BLAKE2s (LZOlayer_fs-20060306.tar.gz) = d2883e04a832f675c6eac3c87301626d59ad873d42fb5ab3a24639134ca12816
 SHA512 (LZOlayer_fs-20060306.tar.gz) = 7696ab1c16e9f9ea8183f408fa7fbadfdf3d29c8927e68aa58d7b533b1c365cbc906a161bb6973ea4724ca9e0c679ea5b772848cc047053028f33218246d5097
 Size (LZOlayer_fs-20060306.tar.gz) = 17669 bytes
 SHA1 (patch-aa) = 70df68443cb7b4d9eec5effea0dbb0e3fc666551
-SHA1 (patch-ab) = 083b6990520ff346109746dcd153584dc9ad5f47
+SHA1 (patch-ab) = d94590c7bce2920c0e41861225e18595be15d832
diff -r bc89684388eb -r ed0eb77c7e6c filesystems/fuse-lzofs/patches/patch-ab
--- a/filesystems/fuse-lzofs/patches/patch-ab   Sun Jan 09 14:41:05 2022 +0000
+++ b/filesystems/fuse-lzofs/patches/patch-ab   Sun Jan 09 15:14:39 2022 +0000
@@ -1,33 +1,42 @@
-$NetBSD: patch-ab,v 1.4 2012/08/17 15:11:57 marino Exp $
+$NetBSD: patch-ab,v 1.5 2022/01/09 15:14:39 pho Exp $
+
+* Use the correct API version. fuse_operations::readdir() was
+  introduced in FUSE 2.3, not 2.2.
+
+* O_LARGEFILE is a Linux-only thing. Don't use it unconditionally.
+
+* Respect the original file attributes in readdir.
+
+* Never cast a pointer to int. That only works on 32-bits platforms
+  and crashes on others.
+
+* Respect the mode_t in mknod.
 
---- LZOlayer_fs.c.orig 2006-05-18 22:23:35.000000000 +0300
-+++ LZOlayer_fs.c      2007-03-16 09:00:48.000000000 +0200
-@@ -21,6 +21,15 @@
+--- LZOlayer_fs.c.orig 2006-05-18 19:23:35.000000000 +0000
++++ LZOlayer_fs.c
+@@ -7,9 +7,10 @@
+     Use it at your OWN RISK
+     Absolutely NO WARANTY
+ */
+-#define FUSE_USE_VERSION 22
++#define FUSE_USE_VERSION 23
+ #include <fuse.h>
+ #include <stdio.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+@@ -21,6 +22,9 @@
  #define __USE_UNIX98
  #include <unistd.h>
  #include <zlib.h>
-+#if !defined (__NetBSD__) && !defined (__DragonFly__)
-+#define ordwr         O_RDWR|O_LARGEFILE
-+#define ordonly       O_RDONLY|O_LARGEFILE
-+#define owronly       O_WRONLY|O_LARGEFILE
-+#else
-+#define ordwr         O_RDWR
-+#define ordonly       O_RDONLY
-+#define owronly       O_WRONLY
++#if !defined(O_LARGEFILE)
++#  define O_LARGEFILE 0
 +#endif
  
  #include "minilzo.h"
  #define HEAP_ALLOC(var, size) \
-@@ -124,7 +133,7 @@
-   
-   if (S_ISREG(stbuf->st_mode))
-   {
--    int fd = open(xPath, O_RDONLY|O_LARGEFILE);
-+    int fd = open(xPath, ordonly);
-     read(fd, &stbuf->st_size, sizeof(off_t));
-     close(fd);
-   }
-@@ -143,15 +152,26 @@
+@@ -143,15 +147,26 @@ static int LZOlayer_getattr(const char *
  
  static int LZOlayer_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi)
  {
@@ -56,47 +65,16 @@
      else break;
    }
    
-@@ -166,7 +186,7 @@
- {
-   char *xPath = LZOlayer_makePath(path);
-   
--  int fd = open(xPath, O_RDONLY|O_LARGEFILE);
-+  int fd = open(xPath, ordonly);
-   off_t outLen = 0;
-   read(fd, &outLen, sizeof(off_t));
-   close(fd);
-@@ -193,7 +213,7 @@
-   char *xPath            = filePtr->path;
-   
-   int done = 0;
--  int fd = open(xPath, O_RDONLY|O_LARGEFILE);
-+  int fd = open(xPath, ordonly);
-   
-   while(1)
-   {
-@@ -249,7 +269,7 @@
-   off_t block_start   = (float)filePtr->packets[min_offset].offset / (float)block_size;
+@@ -181,7 +196,7 @@ static int LZOlayer_open(const char *pat
+   filePtr->cache.size    = 0;
+   filePtr->cache.offset  = 0;
    
-   char *xPath = filePtr->path;
--  int fd      = open(xPath, O_RDWR|O_LARGEFILE);
-+  int fd      = open(xPath, ordwr);
-   LZOlayer_block_seek(fd, block_start);
+-  fi->fh = (int)filePtr;
++  fi->fh = (uintptr_t)filePtr;
    
-   off_t alloc_size = (filePtr->size-(block_start*block_size)
-@@ -315,10 +335,10 @@
-   {
-     LZOlayer_packet_sync(path, fi);
-     
--    int fd = open(filePtr->path, O_WRONLY|O_LARGEFILE);
-+    int fd = open(filePtr->path, owronly);
-     if(fd == -1)
-     {
--      open(filePtr->path, O_CREAT|O_WRONLY|O_LARGEFILE);
-+      open(filePtr->path, O_CREAT|owronly);
-       chown(filePtr->path, fuse_get_context()->uid, fuse_get_context()->gid);
-     }
- // old open/create for write
-@@ -357,15 +377,25 @@
+   return 0;
+ }
+@@ -357,8 +372,18 @@ static int LZOlayer_write(const char *pa
  static int LZOlayer_mknod(const char *path, mode_t mode, dev_t rdev)
  {
    char *xPath = LZOlayer_makePath(path);
@@ -105,7 +83,7 @@
 +  int   res;
 +
 +  if (S_ISREG(mode)) {
-+    res = open(xPath, owronly | O_CREAT | O_TRUNC, 0700);
++    res = open(xPath, O_WRONLY | O_LARGEFILE | O_CREAT | O_TRUNC, 0700);
 +    if (res != -1) {
 +      close(res);
 +      res = 0;
@@ -117,15 +95,7 @@
    if (res == -1)
    {
      res = -errno;
-   }
-   else
-   {
--    int fd = open(xPath, O_WRONLY|O_LARGEFILE);
-+    int fd = open(xPath, owronly);
-     off_t null = 0;
-     write(fd, &null, sizeof(off_t));
-     write(fd, &null, sizeof(off_t));
-@@ -373,6 +403,7 @@
+@@ -373,6 +398,7 @@ static int LZOlayer_mknod(const char *pa
      close(fd);
         
      chown(xPath, fuse_get_context()->uid, fuse_get_context()->gid);
@@ -133,12 +103,3 @@
    }
    free(xPath);
    
-@@ -383,7 +414,7 @@
- {
-   char *xPath = LZOlayer_makePath(path);
-   
--  int fd = open(xPath, O_RDWR|O_LARGEFILE);
-+  int fd = open(xPath, ordwr);
-   off_t file_size = 0;
-   read(fd, &file_size, sizeof(off_t));
-   



Home | Main Index | Thread Index | Old Index