rfuse 1.0.4.RC0 → 1.0.4.RC1

Sign up to get free protection for your applications and to get access to all the features.
data/ext/rfuse/rfuse.c CHANGED
@@ -815,7 +815,8 @@ static VALUE unsafe_read(VALUE *args)
815
815
  VALUE res;
816
816
 
817
817
  res = rb_funcall3(args[0],rb_intern("read"),5,&args[1]);
818
-
818
+ //TODO If res does not implement to_str then you'll get an exception here that
819
+ //is hard to debug
819
820
  return StringValue(res);
820
821
  }
821
822
 
@@ -1006,14 +1007,14 @@ static int rf_setxattr(const char *path,const char *name,
1006
1007
  @param [String] name
1007
1008
 
1008
1009
  @return [String] attribute value
1009
- @raise [Errno] Errno::ENODATA if attribute does not exist
1010
+ @raise [Errno] Errno::ENOATTR if attribute does not exist
1010
1011
 
1011
1012
  */
1012
1013
  static VALUE unsafe_getxattr(VALUE *args)
1013
1014
  {
1014
1015
  VALUE res;
1015
1016
  res = rb_funcall3(args[0],rb_intern("getxattr"),3,&args[1]);
1016
-
1017
+ //TODO - exception won't should that we're calling getxattr
1017
1018
  return StringValue(res);
1018
1019
  }
1019
1020
 
@@ -1023,7 +1024,8 @@ static int rf_getxattr(const char *path,const char *name,char *buf,
1023
1024
  VALUE args[4];
1024
1025
  VALUE res;
1025
1026
  int error = 0;
1026
-
1027
+ long length;
1028
+
1027
1029
  struct fuse_context *ctx=fuse_get_context();
1028
1030
  init_context_path_args(args,ctx,path);
1029
1031
 
@@ -1036,7 +1038,12 @@ static int rf_getxattr(const char *path,const char *name,char *buf,
1036
1038
  }
1037
1039
  else
1038
1040
  {
1039
- return rb_strcpy(res,buf,size);
1041
+ length = rb_strcpy(res,buf,size);
1042
+ if (buf != NULL && length > (long) size)
1043
+ }
1044
+ return -ERANGE;
1045
+ }
1046
+ return length;
1040
1047
  }
1041
1048
  }
1042
1049
 
@@ -1066,16 +1073,25 @@ static int rf_listxattr(const char *path,char *buf, size_t size)
1066
1073
  VALUE args[3];
1067
1074
  VALUE res;
1068
1075
  int error = 0;
1076
+ long length;
1069
1077
 
1070
1078
  struct fuse_context *ctx=fuse_get_context();
1071
1079
  init_context_path_args(args,ctx,path);
1072
1080
 
1073
1081
  res=rb_protect((VALUE (*)())unsafe_listxattr,(VALUE) args,&error);
1074
1082
 
1075
- if (error) {
1083
+ if (error)
1084
+ {
1076
1085
  return -(return_error(ENOENT));
1077
- } else {
1078
- return rb_strcpy(res,buf,size);
1086
+ }
1087
+ else
1088
+ {
1089
+ length = rb_strcpy(res,buf,size);
1090
+ if (buf != NULL && length > (long) size)
1091
+ {
1092
+ return -ERANGE;
1093
+ }
1094
+ return length;
1079
1095
  }
1080
1096
  }
1081
1097
 
data/lib/rfuse/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RFuse
2
- VERSION = "1.0.4.RC0"
2
+ VERSION = "1.0.4.RC1"
3
3
  end
data/spec/xattr_spec.rb CHANGED
@@ -14,12 +14,14 @@ describe RFuse::Fuse do
14
14
  "1"
15
15
  when "user.two"
16
16
  "2"
17
+ when "user.large"
18
+ "x" * 1000
17
19
  else
18
20
  ""
19
21
  end
20
22
  }
21
23
 
22
- mockfs.stub(:listxattr).with(anything(),"/myfile").and_return([ "user.one","user.two" ])
24
+ mockfs.stub(:listxattr).with(anything(),"/myfile").and_return([ "user.one","user.two","user.large" ])
23
25
  mockfs.should_receive(:setxattr).with(anything(),"/myfile","user.three","updated",anything())
24
26
  mockfs.should_receive(:removexattr).with(anything(),"/myfile","user.one")
25
27
 
@@ -29,7 +31,7 @@ describe RFuse::Fuse do
29
31
  xattr = Xattr.new("#{mountpoint}/myfile")
30
32
  xattr.list.should include("user.one")
31
33
  xattr.list.should include("user.two")
32
- xattr.list.size.should == 2
34
+ xattr.list.size.should == 3
33
35
 
34
36
  xattr['user.one'].should == "1"
35
37
  xattr['user.two'].should == "2"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4.RC0
4
+ version: 1.0.4.RC1
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-05 00:00:00.000000000 Z
12
+ date: 2013-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -170,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  segments:
172
172
  - 0
173
- hash: 927008359791353354
173
+ hash: 3887867623874537565
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  none: false
176
176
  requirements: