-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gzip support, take 2 #2509
Gzip support, take 2 #2509
Conversation
The 'DO NOT MERGE' is because I'm not happy with how I find zlib (that is, the user must have it installed, or else GAP won't build). |
Hmm, tests are failing (and issue labels are missing). Will wait with reviewing until this is resolved. |
Codecov Report
@@ Coverage Diff @@
## master #2509 +/- ##
==========================================
- Coverage 74.48% 74.48% -0.01%
==========================================
Files 481 481
Lines 242733 242764 +31
==========================================
+ Hits 180808 180824 +16
- Misses 61925 61940 +15
|
cdce5fc
to
bdec59a
Compare
Travis now fails, but AppVeyor still fails, because of missing zlib headers. This of course would be fixed if zlib was bundled. |
1b3d92e
to
477db3e
Compare
Some changes:
|
598a741
to
91df31d
Compare
configure.ac
Outdated
]) | ||
BUILD_ZLIB=yes | ||
ZLIB_CPPFLAGS='-I${abs_builddir}/extern/install/zlib/include' | ||
ZLIB_LDFLAGS='-L${abs_builddir}/extern/install/zlib/lib -l:libz.a' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-l:libz.a
is not portable (in fact, I could find no documentation on it at all). But it's also not needed here: just change this to:
ZLIB_LDFLAGS='${abs_builddir}/extern/install/zlib/lib/libz.a'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://sourceware.org/binutils/docs/ld/Options.html gives the documentation for -l
. I've used it previously as i don't like compiler's habits of "magically" choosing which file they want (dynamic or static), but I don't know what's "standard" linker behaviour, as opposed to GNU behaviour. I'm happy to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
configure.ac
Outdated
|
||
# Use bundled zlib if requested | ||
AS_IF([test x$BUILD_ZLIB = xyes],[ | ||
AS_IF([test x$CYGWIN = xyes],[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit overkill to move the a huge section of configure.ac
just to check for cygwin here, esp. as that only requires matching $host_os
against *cygwin*
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I do substring matching in configure scripts? Google isn't turning up anything useful. In shell I'd normally do [[ ... ]], but configure doesn't seem to like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I eventually managed to track down you are supposed to use AC_CASE of course....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
This still has a "DO NOT MERGE" label, and I am not sure what it's status is, so I'll refrain from a full review. Just one more comment: GitHub's UI shows that commits ordered by date, which here does not fit their actual order. Perhaps consider doing a |
3318e13
to
9f41940
Compare
Now updated (hopefully) |
@@ -84,15 +84,27 @@ typedef void sig_handler_t ( int ); | |||
#include <mach-o/dyld.h> | |||
#endif | |||
|
|||
#include <zlib.h> | |||
|
|||
|
|||
/* utility to check return value of 'write' */ | |||
ssize_t echoandcheck(int fid, const char *buf, size_t count) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I am not asking you to actually change this, but: wouldn't this have been one of the few cases were one really could have fixed the formatting of the whole function, given that you touch all of it except the first two and last two lines?)
src/sysfiles.c
Outdated
syBuf[fid].isTTY = 0; | ||
syBuf[fid].type = pipe_socket; | ||
syBuf[fid].fp = fileno(syBuf[fid].pipehandle); | ||
syBuf[fid].bufno = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weirdly, the indentation in this case is wrong by one space (but again, I am not really asking you to change this)
src/sysfiles.c
Outdated
ret = gzwrite(syBuf[fid].gzfp, buf, count); | ||
if (ret < 0) | ||
ErrorQuit( | ||
"Cannot write to compressed file, see 'LastSystemError();'\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Language nitpick: If I saw that message, I would think "ah, writing to compressed files is not supported"; but I think what really is meant here is that writing to a compressed file failed. Perhaps "Could not write" or "Failed to write" would be clearer (or maybe that's me as a non-native speaker just not getting it)?
(Again, not necessarily asking you to change this, just wondering)
src/sysfiles.c
Outdated
else { | ||
ret = write(syBuf[fid].echo, buf, count); | ||
if (ret < 0) | ||
ErrorQuit("Cannot write to file descriptor %d, see " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above (but of course this message is old and predates this PR)
src/sysfiles.h
Outdated
UInt ateof; /* set to 1 by any read operation that hits eof | ||
/* gzfp is used if type == gzip_socket | ||
** Stored as a void* to avoid including zlib.h */ | ||
void* gzfp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting: space before *
(but we can also fix this afterwards -- indeed, with your PR merged, I think we are close to making syBuf
private to sysfiles.h
, then we could move this out of the header and into the .c file, and take care of formatting in this struct overall)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we could try moving this into sysfiles.h later. I did at some point run clang-format on this part, but it totally changed the whole struct and I wanted it to be clear what I'd added/changed.
@fingolfin , while many of reformatting comments are reasonable, I'd prefer to merge this and then make cleanups later, partly because it will be a pain to figure out which changes have to go in which of the existing commits. |
I'd merge this now but there was a build failure, seemingly due to a network problem. I just restarted that job, if it passes, we can merge. |
This is a cleaned up attempt at adding gzip support to GAP.
I recommend reading this commit by commit. The changes are:
First two commits: PR #2508, to disable a warning in the new code
3rd commit: Add zlib to configure (note, this should / will be improved).
4th/5th commit: This abstracts out most uses of
read
andwrite
to use aSyRead
andSyWrite
function. At this point this seems fairly useless, but it will make adding gzip support a much smaller change.6th commit: Actually add gzip
7th commit: Testing