Closed HuStmpHrrr closed 6 years ago
I created a PR for the third point: https://github.com/Microsoft/dafny/pull/186
However, I don't think point 1 and 2 are the problem from source code. Is the build built on a Windows machine? that would be the problem.
Hi, thank you for merging.
Could someone know the building process comment on point 1 and 2?
I believe I fixed (2) after the latest release (see c9f52fe), so that should work for the next version. For (1), the packaging script does try to add the executable bit to those scripts, but it doesn't seem to stick (at least on my Mac). I'll experiment with that some more.
@jamesbornholt is the packaging script https://github.com/Microsoft/dafny/blob/master/package.py ?
Yep. Line 147 is the magic line. And, as you suspected, it gets run on Windows.
The problem is the permission bits should be 0100777 << 16
. also the next line of reading file contents is suspicious.
the permission bits should be
0100777 << 16
or not. I am not sure then. one needs to test it on a windows machine to know what's happening.
The permission bits, unfortunately, actually got into the zip file. it's just for some reason, when uncompressing, the bits are not recovered. I can confirm that because I can see the bits set in the hex dump of the zip file:
02676d30: 2e70 6462 504b 0102 1400 1400 0000 0800 .pdbPK..........
02676d40: 136a 8c4b c0dd a18e d900 0000 4b01 0000 .j.K........K...
02676d50: 0b00 0000 0000 0000 0000 0000 ff01 6b78 ..............kx
02676d60: 0602 6461 666e 792f 6461 666e 7950 4b01 ..dafny/dafnyPK.
this row
02676d50: 0b00 0000 0000 0000 0000 0000 ff01 6b78 ..............kx
the 4 bytes 0000 ff01
exactly encodes 0777
permission, i.e. the higher 2 bytes of the external file attribute is 0x01ff
. according to standard https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT section 4.3.12, this encodes as intended. I am uncertain what caused the permission bits unset after decompression. it's either due to the file head which says file is compressed in MS instead of UNIX, or otherwise it's a bug in unzip
.
This should be fixed in the packaging script now, so the next binary release should work fine (I just tested by packaging on Windows and extracting on both Linux and macOS).
I also updated the fix from #186 to be portable to macOS (and other BSDs I guess), which doesn't support the -f
flag to readlink
.
Thanks for the report!
oh wow. so it's indeed the OS flag. good to know such quirk exists.
I was install Dafny on my system:
and I downloaded this version: https://github.com/Microsoft/dafny/releases/tag/v2.1.1
And to make it run, I have discovered following issues:
both
dafny
anddafny-server
is not executable by default. Therefore I need to dochmod +x
myself. This is not a problem for most of the linux users, but it's something good to have.dafny
is coded up in windows environment, therefore when executing it in Linux environment, it inevitably has following issue:I will need to run
dos2unix
to fix bothdafny
anddafny-server
. This is also not a big deal for most of the users, but still something very good to have.dafny
and executing it from there will create an issue, due to how the script is coded up:The reason for that is the following line:
When creating symlink,
${BASH_SOURCE[0]}
points to the symlink instead of the real location of the file, hence the error. I personally fixed it in following way:It should work for most of the modern linux systems. However, I am not sure how portable is that. I believe, for example, in Solaris system,
readlink
does not have-f
option. Do you guys good with fix like that?