Skip to content

Conversation

WalterBright
Copy link
Member

I've been using this to set execute attribute bits when zipping release packages on windows, because the windows zip32 utility doesn't. Usage is like:

dmd2.zip:
del dmd2.zip
zip32 -r dmd2 \dmd2*
chmodzip dmd2.zip 0755
dmd2/freebsd/bin32/rdmd
dmd2/freebsd/bin32/dmd
dmd2/freebsd/bin32/obj2asm
dmd2/freebsd/bin32/dumpobj
dmd2/freebsd/bin32/dman
dmd2/freebsd/bin32/shell
dmd2/freebsd/bin32/ddemangle
dmd2/linux/bin32/rdmd
dmd2/linux/bin32/dmd
dmd2/linux/bin32/obj2asm
dmd2/linux/bin32/dumpobj
dmd2/linux/bin32/dman
dmd2/linux/bin32/ddemangle
dmd2/linux/bin64/rdmd
dmd2/linux/bin64/dmd
dmd2/linux/bin64/obj2asm
dmd2/linux/bin64/dumpobj
dmd2/linux/bin64/dman
dmd2/linux/bin64/ddemangle
dmd2/osx/bin/dumpobj
dmd2/osx/bin/obj2asm
dmd2/osx/bin/shell
dmd2/osx/bin/dmd
dmd2/osx/bin/rdmd
dmd2/osx/bin/dman
dmd2/osx/bin/ddemangle

if (de.name == member && ((de.externalAttributes >> 16) & 07777) != newattr)
{ changes = true;
de.madeVersion = 0x317; // necessary or linux unzip will ignore attributes
de.externalAttributes = (de.externalAttributes & ~(07777 << 16)) | (newattr << 16);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use octal!7777.

@MartinNowak
Copy link
Member

Are there alternatives to using Info-Zip that would fix the problem?

I hope that we still manage to put all necessary files into the installers
rather than distributing one fat zip. Maybe something to tackle right after the release?

if (args.length == 1)
{
writeln("Usage: zip zipfile attr members...");
exit(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just return 0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather return 1, as this is an error condition.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also please write to stderr

@andralex
Copy link
Member

@WalterBright ping on that, several review points should be addressed

@andralex
Copy link
Member

@WalterBright ping

@MartinNowak
Copy link
Member

We now support to set attributes use std.zip.fileAttributes, but only for the current platform.
Additionally we could add fileAttributesUnix and fileAttributesWindows to support this use case.

@WalterBright
Copy link
Member Author

Since this program in its current form already exists and has been in use for years as part of the release process, I believe it best to be incorporated in its existing form as the initial revision. After that, I'll issue a PR to address the comments above.

@andralex
Copy link
Member

OK please follow up

andralex added a commit that referenced this pull request Dec 27, 2013
@andralex andralex merged commit b94a5f0 into dlang:master Dec 27, 2013
@WalterBright
Copy link
Member Author

Ok, I started on the PR to address the above issues.

But I can't compile it because "madeVersion" is now read-only.

https://d.puremagic.com/issues/show_bug.cgi?id=11831

@andralex
Copy link
Member

fileAttributesUnix and fileAttributesWindows seem quite bad (knee jerk reaction)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants