Browse Source

always set write bit in all mounts (except SD)

2.0
Ian Burgwin 10 months ago
parent
commit
66898891a0
Signed by: ianburgwin
GPG Key ID: 90725113CA578EAA
  1. 4
      ninfs/mount/cci.py
  2. 4
      ninfs/mount/cdn.py
  3. 4
      ninfs/mount/cia.py
  4. 4
      ninfs/mount/exefs.py
  5. 4
      ninfs/mount/nandbb.py
  6. 4
      ninfs/mount/nandctr.py
  7. 4
      ninfs/mount/nandhac.py
  8. 4
      ninfs/mount/nandtwl.py
  9. 4
      ninfs/mount/ncch.py
  10. 4
      ninfs/mount/romfs.py
  11. 4
      ninfs/mount/sdtitle.py
  12. 4
      ninfs/mount/srl.py
  13. 4
      ninfs/mount/threedsx.py

4
ninfs/mount/cci.py

@ -74,9 +74,9 @@ class CTRCartImageMount(LoggingMixIn, Operations): @@ -74,9 +74,9 @@ class CTRCartImageMount(LoggingMixIn, Operations):
return self.dirs[first_dir].getattr(_c.remove_first_dir(path), fh)
uid, gid, pid = fuse_get_context()
if path == '/':
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | 0o444), 'st_size': self.reader.sections[self.files[path]].size, 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': self.reader.sections[self.files[path]].size, 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)
return {**st, **self.g_stat, 'st_uid': uid, 'st_gid': gid}

4
ninfs/mount/cdn.py

@ -92,9 +92,9 @@ class CDNContentsMount(LoggingMixIn, Operations): @@ -92,9 +92,9 @@ class CDNContentsMount(LoggingMixIn, Operations):
return self.dirs[first_dir].getattr(_c.remove_first_dir(path), fh)
uid, gid, pid = fuse_get_context()
if path == '/' or path in self.dirs:
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | 0o444), 'st_size': self.files[path][2], 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': self.files[path][2], 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)
return {**st, **self.g_stat, 'st_uid': uid, 'st_gid': gid}

4
ninfs/mount/cia.py

@ -91,9 +91,9 @@ class CTRImportableArchiveMount(LoggingMixIn, Operations): @@ -91,9 +91,9 @@ class CTRImportableArchiveMount(LoggingMixIn, Operations):
return self.dirs[first_dir].getattr(_c.remove_first_dir(path), fh)
uid, gid, pid = fuse_get_context()
if path == '/' or path in self.dirs:
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | 0o444), 'st_size': self.files[path][2], 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': self.files[path][2], 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)
return {**st, **self.g_stat, 'st_uid': uid, 'st_gid': gid}

4
ninfs/mount/exefs.py

@ -96,7 +96,7 @@ class ExeFSMount(LoggingMixIn, Operations): @@ -96,7 +96,7 @@ class ExeFSMount(LoggingMixIn, Operations):
def getattr(self, path, fh=None):
uid, gid, pid = fuse_get_context()
if path == '/':
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
else:
if path in self.files:
item = self.reader.entries[self.files[path]]
@ -106,7 +106,7 @@ class ExeFSMount(LoggingMixIn, Operations): @@ -106,7 +106,7 @@ class ExeFSMount(LoggingMixIn, Operations):
size = item['size']
else:
raise FuseOSError(ENOENT)
st = {'st_mode': (S_IFREG | 0o444), 'st_size': size, 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': size, 'st_nlink': 1}
return {**st, **self.g_stat, 'st_uid': uid, 'st_gid': gid}
def open(self, path, flags):

4
ninfs/mount/nandbb.py

@ -106,9 +106,9 @@ class BBNandImageMount(LoggingMixIn, Operations): @@ -106,9 +106,9 @@ class BBNandImageMount(LoggingMixIn, Operations):
def getattr(self, path, fh=None):
uid, gid, pid = fuse_get_context()
if path == '/':
st = {'st_mode': (S_IFDIR | (0o555)), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | (0o444)),
st = {'st_mode': (S_IFREG | 0o666),
'st_size': self.files[path]['size'], 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)

4
ninfs/mount/nandctr.py

@ -265,9 +265,9 @@ class CTRNandImageMount(LoggingMixIn, Operations): @@ -265,9 +265,9 @@ class CTRNandImageMount(LoggingMixIn, Operations):
else:
uid, gid, pid = fuse_get_context()
if path in {'/', '/essential'}:
st = {'st_mode': (S_IFDIR | (0o555 if self.readonly else 0o777)), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | (0o444 if self.readonly else 0o666)),
st = {'st_mode': (S_IFREG | 0o666),
'st_size': self.files[path]['size'], 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)

4
ninfs/mount/nandhac.py

@ -118,10 +118,10 @@ class HACNandImageMount(LoggingMixIn, Operations): @@ -118,10 +118,10 @@ class HACNandImageMount(LoggingMixIn, Operations):
def getattr(self, path: str, fh=None):
uid, gid, pid = fuse_get_context()
if path == '/':
st = {'st_mode': (S_IFDIR | (0o555 if self.readonly else 0o777)), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
p = self.files[path]
st = {'st_mode': (S_IFREG | (0o444 if self.readonly else 0o666)),
st = {'st_mode': (S_IFREG | 0o666),
'st_size': p['end'] - p['start'], 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)

4
ninfs/mount/nandtwl.py

@ -150,9 +150,9 @@ class TWLNandImageMount(LoggingMixIn, Operations): @@ -150,9 +150,9 @@ class TWLNandImageMount(LoggingMixIn, Operations):
def getattr(self, path, fh=None):
uid, gid, pid = fuse_get_context()
if path == '/':
st = {'st_mode': (S_IFDIR | (0o555 if self.readonly else 0o777)), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | (0o444 if self.readonly else 0o666)),
st = {'st_mode': (S_IFREG | 0o666),
'st_size': self.files[path]['size'], 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)

4
ninfs/mount/ncch.py

@ -81,9 +81,9 @@ class NCCHContainerMount(LoggingMixIn, Operations): @@ -81,9 +81,9 @@ class NCCHContainerMount(LoggingMixIn, Operations):
return self.romfs_fuse.getattr(_c.remove_first_dir(path), fh)
uid, gid, pid = fuse_get_context()
if path in {'/', '/romfs', '/exefs'}:
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | 0o444), 'st_size': self.reader.sections[self.files[path]].size, 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': self.reader.sections[self.files[path]].size, 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)
return {**st, **self.g_stat, 'st_uid': uid, 'st_gid': gid}

4
ninfs/mount/romfs.py

@ -45,9 +45,9 @@ class RomFSMount(LoggingMixIn, Operations): @@ -45,9 +45,9 @@ class RomFSMount(LoggingMixIn, Operations):
except RomFSFileNotFoundError:
raise FuseOSError(ENOENT)
if item.type == 'dir':
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif item.type == 'file':
st = {'st_mode': (S_IFREG | 0o444), 'st_size': item.size, 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': item.size, 'st_nlink': 1}
else:
# this won't happen unless I fucked up
raise FuseOSError(ENOENT)

4
ninfs/mount/sdtitle.py

@ -92,9 +92,9 @@ class SDTitleContentsMount(LoggingMixIn, Operations): @@ -92,9 +92,9 @@ class SDTitleContentsMount(LoggingMixIn, Operations):
return self.dirs[first_dir].getattr(_c.remove_first_dir(path), fh)
uid, gid, pid = fuse_get_context()
if path == '/' or path in self.dirs:
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | 0o444), 'st_size': self.files[path][2], 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': self.files[path][2], 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)
return {**st, **self.g_stat, 'st_uid': uid, 'st_gid': gid}

4
ninfs/mount/srl.py

@ -234,9 +234,9 @@ class SRLMount(LoggingMixIn, Operations): @@ -234,9 +234,9 @@ class SRLMount(LoggingMixIn, Operations):
uid, gid, pid = fuse_get_context()
item = self.parse_path(path)
if item['type'] == 'dir':
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif item['type'] == 'file':
st = {'st_mode': (S_IFREG | 0o444), 'st_size': item['size'], 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': item['size'], 'st_nlink': 1}
else:
# this won't happen unless I fucked up
raise FuseOSError(ENOENT)

4
ninfs/mount/threedsx.py

@ -78,9 +78,9 @@ class ThreeDSXMount(LoggingMixIn, Operations): @@ -78,9 +78,9 @@ class ThreeDSXMount(LoggingMixIn, Operations):
return self.romfs_fuse.getattr(_c.remove_first_dir(path), fh)
uid, gid, pid = fuse_get_context()
if path == '/' or path == '/romfs':
st = {'st_mode': (S_IFDIR | 0o555), 'st_nlink': 2}
st = {'st_mode': (S_IFDIR | 0o777), 'st_nlink': 2}
elif path in self.files:
st = {'st_mode': (S_IFREG | 0o444), 'st_size': self.files[path]['size'], 'st_nlink': 1}
st = {'st_mode': (S_IFREG | 0o666), 'st_size': self.files[path]['size'], 'st_nlink': 1}
else:
raise FuseOSError(ENOENT)
return {**st, **self.g_stat, 'st_uid': uid, 'st_gid': gid}

Loading…
Cancel
Save