Opened 9 years ago

Closed 4 weeks ago

#11169 closed defect (invalid)

Make testcc.sh exit with an exit code of 1 if preprocessing a file fails.

Reported by: drkirkby Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: scripts Keywords: sd32
Cc: jhpalmieri, mkoeppe, gh-kliem Merged in:
Authors: David Kirkby Reviewers: Jonathan Kliem
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

The script $SAGE_ROOT/spkg/bin/testcc.sh checks to see what C compiler the environment variable $CC is. But currently the script always exits with a 0, even if an error occurs.

This patch will correct that.

Note some forms of error will not be detected. If CC is defined as ls, then the code will try to list the C file, which will succeed without error. But the changes will allow one to check if a compiler is installed or not.

drkirkby@hawk:~$ export CC=cc
drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
Sun_Studio
drkirkby@hawk:~$ export CC=gcc
drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
GCC
drkirkby@hawk:~$ export CC=junk
drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
Error - junk is not compiling a C file properly

Apply 11169_testcc.patch to the SAGE_ROOT repository.

Attachments (1)

11169_testcc.patch (787 bytes) - added by jdemeyer 8 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 9 years ago by drkirkby

  • Status changed from new to needs_review
  • Type changed from PLEASE CHANGE to defect

comment:2 follow-up: Changed 9 years ago by mariah

  • Status changed from needs_review to needs_info

Where is test.cc used? It does not seem to be used by prereq-0.9 in sage-4.7.rc4.

comment:3 Changed 9 years ago by was

  • Keywords sd32 added

comment:4 in reply to: ↑ 2 Changed 8 years ago by drkirkby

  • Status changed from needs_info to needs_review

Replying to mariah:

Where is test.cc used? It does not seem to be used by prereq-0.9 in sage-4.7.rc4.

Some of the .spkg's use it. Not many I must admit, but a few do, mainly in an attempt to support the Sun (now Oracle) compiler, but it might be used for AIX/HP-UX too.

It would be worth fixing this bug. It might be sensible to add support for 'clang' to this script later, although since that's supposed to be compatible with gcc, perhaps it's not needed.

Changed 8 years ago by jdemeyer

comment:5 Changed 8 years ago by jdemeyer

  • Description modified (diff)

comment:6 Changed 8 years ago by jdemeyer

  • Description modified (diff)
  • Status changed from needs_review to needs_info
  • Summary changed from Make testcc.sh exit with an exit code of 1 if attempting to compile a file fails. to Make testcc.sh exit with an exit code of 1 if preprocessing a file fails.

I'm not entirely sure this patch is a good idea. How universal is the command line option "-E" to run the preprocessor?

comment:7 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:8 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:9 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:10 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:11 Changed 5 weeks ago by chapoton

  • Cc mkoeppe added
  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Status changed from needs_info to needs_review

is this ancient ticket now obsolete ?

comment:12 Changed 5 weeks ago by mkoeppe

  • Cc gh-kliem added

comment:13 Changed 4 weeks ago by gh-kliem

  • Reviewers set to Jonathan Kliem
  • Status changed from needs_review to positive_review

I agree that this is invalid.

Currently, there is no use case for this ticket. We only use local/bin/testcc.sh to check whether or not a compiler is GCC or Sun_Studio or HP_on_HP-UX. It is never used to check whether or not a compiler is suitable for anything.

comment:14 Changed 4 weeks ago by chapoton

  • Resolution set to invalid
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.