Closed Bug 971802 Opened 10 years ago Closed 10 years ago

Make mozpack+mozjar capable of storing unix file permissions in jars

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla30

People

(Reporter: ted, Assigned: ted)

References

Details

Attachments

(1 file, 1 obsolete file)

It turns out that mozjar doesn't currently support storing Unix file permissions. This patch fixes this through the entire stack (mozjar, mozpack) so that adding files to a Jarrer does the right thing.
Blocks: 903620
Accidentally qref'ed that into another patch, here's the right patch.
Attachment #8374931 - Flags: review?(mh+mozilla)
Attachment #8374928 - Attachment is obsolete: true
Attachment #8374928 - Flags: review?(mh+mozilla)
Comment on attachment 8374931 [details] [diff] [review]
Make mozpack capable of storing unix file permissions in jars

Review of attachment 8374931 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozpack/files.py
@@ +179,5 @@
>      '''
>      def __init__(self, path):
>          self.path = path
>  
> +    def mode(self):

@property

::: python/mozbuild/mozpack/mozjar.py
@@ +602,3 @@
>          entry['creator_version'] = 20
> +        if mode is not None:
> +            # Set create system so mode is honored.

# Set creator host system (upper byte of creator_version) to 3 (Unix) so mode is honored when there is one.

@@ +602,4 @@
>          entry['creator_version'] = 20
> +        if mode is not None:
> +            # Set create system so mode is honored.
> +            entry['creator_version'] |= 3 << 8

BTW, can you fix "host = entry['creator_version'] >> 16" in JarReader.entries? it's wrong (16 should be 8).

@@ +617,5 @@
>          entry['crc32'] = deflater.crc32
>          entry['compressed_size'] = deflater.compressed_size
>          entry['uncompressed_size'] = deflater.uncompressed_size
> +        if mode is not None:
> +            entry['external_attr'] = (mode & 0xFFFF) << 16L

You could group both ifs
Attachment #8374931 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/cf5d9c8a1368
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: