View | Details | Raw Unified | Return to bug 226313
Collapse All | Expand All

(-)sysutils/fusefs-s3fs/Makefile (-5 / +5 lines)
Lines 3-13 Link Here
3
3
4
PORTNAME=	s3fs
4
PORTNAME=	s3fs
5
DISTVERSIONPREFIX=	v
5
DISTVERSIONPREFIX=	v
6
DISTVERSION=	1.78
6
DISTVERSION=	1.83
7
CATEGORIES=	sysutils
7
CATEGORIES=	sysutils
8
PKGNAMEPREFIX=	fusefs-
8
PKGNAMEPREFIX=	fusefs-
9
9
10
MAINTAINER=	ports@FreeBSD.org
10
MAINTAINER=	dg@syrec.org
11
COMMENT=	FUSE-based file system backed by Amazon S3
11
COMMENT=	FUSE-based file system backed by Amazon S3
12
12
13
LICENSE=	GPLv2
13
LICENSE=	GPLv2
Lines 15-27 Link Here
15
LIB_DEPENDS=	libcurl.so:ftp/curl \
15
LIB_DEPENDS=	libcurl.so:ftp/curl \
16
		libxml2.so:textproc/libxml2
16
		libxml2.so:textproc/libxml2
17
17
18
USES=		autoreconf fuse pkgconfig ssl
19
GNU_CONFIGURE=	yes
20
18
USE_GITHUB=	yes
21
USE_GITHUB=	yes
19
GH_ACCOUNT=	s3fs-fuse
22
GH_ACCOUNT=	s3fs-fuse
20
GH_PROJECT=	s3fs-fuse
23
GH_PROJECT=	s3fs-fuse
21
24
22
USES=		autoreconf fuse pkgconfig ssl
23
GNU_CONFIGURE=	yes
24
25
PLIST_FILES=	bin/s3fs man/man1/s3fs.1.gz
25
PLIST_FILES=	bin/s3fs man/man1/s3fs.1.gz
26
26
27
post-patch:
27
post-patch:
(-)sysutils/fusefs-s3fs/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1483466309
1
TIMESTAMP = 1520013498
2
SHA256 (s3fs-fuse-s3fs-fuse-v1.78_GH0.tar.gz) = 36c0b00a294d9676c462985c0c3f1362540e8ebc61c15bacb45e28a2f00297f5
2
SHA256 (s3fs-fuse-s3fs-fuse-v1.83_GH0.tar.gz) = 8f060accef304c1e5adde0c9d6976a3a69fd9935444a4985517c6cefa86b34ef
3
SIZE (s3fs-fuse-s3fs-fuse-v1.78_GH0.tar.gz) = 99538
3
SIZE (s3fs-fuse-s3fs-fuse-v1.83_GH0.tar.gz) = 150816
(-)sysutils/fusefs-s3fs/files/patch-src_common.h (+11 lines)
Line 0 Link Here
1
Upstream PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/729
2
--- src/common.h.orig	2018-03-02 20:49:09 UTC
3
+++ src/common.h
4
@@ -21,6 +21,7 @@
5
 #ifndef S3FS_COMMON_H_
6
 #define S3FS_COMMON_H_
7
 
8
+#include <stdlib.h>
9
 #include "../config.h"
10
 
11
 //
(-)sysutils/fusefs-s3fs/files/patch-src_s3fs.cpp (+23 lines)
Line 0 Link Here
1
Upstream PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/729
2
--- src/s3fs.cpp.orig	2017-12-17 07:53:49 UTC
3
+++ src/s3fs.cpp
4
@@ -2973,15 +2973,19 @@ static int set_xattrs_to_header(headers_
5
 
6
   headers_t::iterator iter;
7
   if(meta.end() == (iter = meta.find("x-amz-meta-xattr"))){
8
+#if defined(XATTR_REPLACE)
9
     if(XATTR_REPLACE == (flags & XATTR_REPLACE)){
10
       // there is no xattr header but flags is replace, so failure.
11
       return -ENOATTR;
12
     }
13
+#endif
14
   }else{
15
+#if defined(XATTR_CREATE)
16
     if(XATTR_CREATE == (flags & XATTR_CREATE)){
17
       // found xattr header but flags is only creating, so failure.
18
       return -EEXIST;
19
     }
20
+#endif
21
     strxattrs = iter->second;
22
   }
23
 
(-)sysutils/fusefs-s3fs/files/patch-src_s3fs__util.cpp (+81 lines)
Line 0 Link Here
1
Upstream PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/729
2
--- src/s3fs_util.cpp.orig	2017-12-17 07:53:49 UTC
3
+++ src/s3fs_util.cpp
4
@@ -453,6 +453,7 @@ AutoLock::~AutoLock()
5
 string get_username(uid_t uid)
6
 {
7
   static size_t maxlen = 0;	// set once
8
+  int result;
9
   char* pbuf;
10
   struct passwd pwinfo;
11
   struct passwd* ppwinfo = NULL;
12
@@ -461,9 +462,17 @@ string get_username(uid_t uid)
13
   if(0 == maxlen){
14
     long res = sysconf(_SC_GETPW_R_SIZE_MAX);
15
     if(0 > res){
16
-      S3FS_PRN_WARN("could not get max pw length.");
17
-      maxlen = 0;
18
-      return string("");
19
+      // SUSv4tc1 says the following about _SC_GETGR_R_SIZE_MAX and
20
+      // _SC_GETPW_R_SIZE_MAX:
21
+      // Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if
22
+      // there is no hard limit on the size of the buffer needed to
23
+      // store all the groups returned.
24
+      if (errno != 0){
25
+        S3FS_PRN_WARN("could not get max pw length.");
26
+        maxlen = 0;
27
+        return string("");
28
+      }
29
+      res = 1024; // default initial length
30
     }
31
     maxlen = res;
32
   }
33
@@ -471,12 +480,22 @@ string get_username(uid_t uid)
34
     S3FS_PRN_CRIT("failed to allocate memory.");
35
     return string("");
36
   }
37
-  // get group information
38
-  if(0 != getpwuid_r(uid, &pwinfo, pbuf, maxlen, &ppwinfo)){
39
-    S3FS_PRN_WARN("could not get pw information.");
40
+  // get pw information
41
+  while(ERANGE == (result = getpwuid_r(uid, &pwinfo, pbuf, maxlen, &ppwinfo))){
42
+    free(pbuf);
43
+    maxlen *= 2;
44
+    if(NULL == (pbuf = (char*)malloc(sizeof(char) * maxlen))){
45
+      S3FS_PRN_CRIT("failed to allocate memory.");
46
+      return string("");
47
+    }
48
+  }
49
+
50
+  if(0 != result){
51
+    S3FS_PRN_ERR("could not get pw information(%d).", result);
52
     free(pbuf);
53
     return string("");
54
   }
55
+
56
   // check pw
57
   if(NULL == ppwinfo){
58
     free(pbuf);
59
@@ -498,10 +517,18 @@ int is_uid_include_group(uid_t uid, gid_
60
   // make buffer
61
   if(0 == maxlen){
62
     long res = sysconf(_SC_GETGR_R_SIZE_MAX);
63
-    if(0 > res){
64
-      S3FS_PRN_ERR("could not get max name length.");
65
-      maxlen = 0;
66
-      return -ERANGE;
67
+    if(0 > res) {
68
+      // SUSv4tc1 says the following about _SC_GETGR_R_SIZE_MAX and
69
+      // _SC_GETPW_R_SIZE_MAX:
70
+      // Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if
71
+      // there is no hard limit on the size of the buffer needed to
72
+      // store all the groups returned.
73
+      if (errno != 0) {
74
+        S3FS_PRN_ERR("could not get max name length.");
75
+        maxlen = 0;
76
+        return -ERANGE;
77
+      }
78
+      res = 1024; // default initial length
79
     }
80
     maxlen = res;
81
   }

Return to bug 226313