Skip to content
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

Fix 'gap --version' to send its output to stdout and include a trailing newline #5864

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

fingolfin
Copy link
Member

Also add a trailing newline.

Apparently it was printing to stdin before. Even after looking at the code I completely fail to see why it did that. But while I'd love to get to the bottom of this, let's first get this trivial fix out of the door.

@fingolfin fingolfin added topic: kernel release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes backport-to-4.14-DONE labels Dec 7, 2024
@fingolfin
Copy link
Member Author

OK it seems the issue is caused by our file descriptors not being initialized yet. The means the other SyFputs calls hidden by #ifdef GAP_MEM_CHECK in src/system.c may also have an issue and should be changed to fputs(..., stderr). But I can't easily test this code, but perhaps @ChrisJefferson is willing to patch those

Copy link
Member

@dimpase dimpase left a comment

Choose a reason for hiding this comment

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

it looks like there are too many line breaks now:

$ ./gap --version
GAP 
4.14.0-22-g00e3a64
 built on 
2024-12-09 11:12:42-0600

@dimpase
Copy link
Member

dimpase commented Dec 9, 2024

I can confirm that ./gap --version </dev/null no longer causes a crash.

@fingolfin fingolfin force-pushed the mh/fix-gap--version branch from 3219249 to 9dbae20 Compare December 9, 2024 19:52
@dimpase
Copy link
Member

dimpase commented Dec 9, 2024

  C       src/gasman.c => build/obj/src/gasman.c.o
src/gasman.c: In function ‘enableMemCheck’:
src/gasman.c:1143:5: error: implicit declaration of function ‘fputs’ [-Wimplicit-function-declaration]
 1143 |     fputs("# Warning: --enableMemCheck causes SEVERE slowdowns. Starting GAP may take several days!\n", stderr);
      |     ^~~~~
src/gasman.c:138:1: note: include ‘<stdio.h>’ or provide a declaration of ‘fputs’
  137 | #include <sys/mman.h>
  +++ |+#include <stdio.h>
  138 | #endif
src/gasman.c:1143:105: error: ‘stderr’ undeclared (first use in this function)
 1143 |     fputs("# Warning: --enableMemCheck causes SEVERE slowdowns. Starting GAP may take several days!\n", stderr);
      |                                                                                                         ^~~~~~
src/gasman.c:1143:105: note: ‘stderr’ is defined in header ‘<stdio.h>’; this is probably fixable by adding ‘#include <stdio.h>’
src/gasman.c:1143:105: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile.rules:426: build/obj/src/gasman.c.o] Error 1

@fingolfin fingolfin force-pushed the mh/fix-gap--version branch from 9dbae20 to a18a932 Compare December 9, 2024 21:08
Copy link
Member

@dimpase dimpase left a comment

Choose a reason for hiding this comment

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

lgtm

@ChrisJefferson ChrisJefferson merged commit 30eb22e into gap-system:master Dec 10, 2024
31 of 33 checks passed
@fingolfin fingolfin deleted the mh/fix-gap--version branch December 10, 2024 07:51
@fingolfin
Copy link
Member Author

Backported to stable-4.14 in eeba5ab1b47d2c20cdaa0302b162ce7264c38f82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-4.14-DONE release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants