Page MenuHomeSoftware Heritage

swh-model generates directory entries with bogus permissions
Closed, MigratedEdits Locked

Description

swh.model (and therefore all the loaders that use it) generates directory entry permissions as decimal numbers (eg 100644) instead of the proper value (0o100644 = 33188).

Thankfully, it computes the identifier for the directory with the proper, octal value, so only the database value needs changing - we don't need to recompute identifiers.

Event Timeline

As far as I can tell, the main issue here is that the data returned by swh.model.git is inconsistent with what either swh.model.identifiers or the database expects.

One way forward could be to refactor swh.model.git to generate directory manifests that can directly be passed to swh.model.identifiers as well as swh.storage without an extra conversion step (see swh.model.git._compute_directory_git_sha1).

For that purpose the enums GitType and GitPerm should probably not be exported any longer, at least not under those names. The uses of those enums in subclasses should be reviewed.

Once that leaky abstraction is plugged, the swh.model.git module could be renamed to something less specific, and showing its true purpose, e.g. swh.model.fromdisk.

zack moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Feb 21 2017, 8:23 AM
In T685#12298, @olasd wrote:

As far as I can tell, the main issue here is that the data returned by swh.model.git is inconsistent with what either swh.model.identifiers or the database expects.

One way forward could be to refactor swh.model.git to generate directory manifests that can directly be passed to swh.model.identifiers as well as swh.storage without an extra conversion step (see swh.model.git._compute_directory_git_sha1).

That sounds sensible. Having a single place where those IDs are computer would (obviously :)) avoid further inconsistencies in the future.