Page MenuHomeSoftware Heritage

Support "weird" permissions in directories
Closed, WontfixPublic


Many git directories have permissions "040000" instead of "40000".

It's also possible there are other types of weird permissions non-octal or longer than 6 octal digits permissions (though I have not seen any yet)

We should be able to store them.

Event Timeline

vlorentz triaged this task as Normal priority.Sep 22 2021, 1:36 PM
vlorentz created this task.

Possible solution: store them as an ascii string instead of an integer.

(An alternative would be a zero_padded boolean, but that's ugly and does not cover the other weird cases)

Complete proposal for the above solution:

  1. add this to swh.model.model.DirectoryEntry (DirectoryEntry.from_dict can set it if it's missing):
perms_oct = attr.ib(type=str, validators=type_validator())           
"""Same as 'perms', but unparsed. This is (or should be) a POSIX-like
permission mode, formatted in octal with no leading zero."""
  1. add the column in postgresql and cass, make the python code write it but not read, it can fill the value from the old column
  1. have a script to fill the new column
  1. optionally, make sure no component depends on the perms attribute
  1. remove that attribute and the corresponding columns (or make it a property that parses perms_oct if we want to allow other packages to still use it)
vlorentz claimed this task.

We decided to store manifests instead. T3594#74385