Navigation Menu

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

configure makes improper assumptions on /bin/sh #3076

Closed
DorpsGek opened this issue Aug 1, 2009 · 5 comments
Closed

configure makes improper assumptions on /bin/sh #3076

DorpsGek opened this issue Aug 1, 2009 · 5 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Aug 1, 2009

Nixx opened the ticket and wrote:

The configure script coming with openttd-0.7.2 starts with "# !/bin/sh", but is assuming that shell supports bash-syntax (first time in multi line string starting in :88). On linux that assumptions seems to hold more often than not, on unix (open solaris in this case) however, that makes configure fail:

--
configure[88]: : cannot execute [Is a directory]
gawk: cmd. line:5: gsub("
gawk: cmd. line:5: ^ unterminated string
configure[88]: , , configure);
gsub(^# if: not found [No such file or directory]
configure[135]: : cannot execute [Is a directory]
gawk: { ORS = "
gawk: ^ unterminated string
configure[135]: } /.c$/ { gsub(.c, .o, configure); print configure; }': not found [No such file or directory]
configure[136]: : cannot execute [Is a directory]
gawk: { ORS = "
gawk: ^ unterminated string
configure[136]: } /.cpp$/ { gsub(.cpp, .o, configure); print configure; }': not found [No such file or directory]
configure[137]: : cannot execute [Is a directory]
gawk: { ORS = "
gawk: ^ unterminated string
configure[137]: } /.mm$/ { gsub(.mm, .o, configure); print configure; }': not found [No such file or directory]
configure[138]: : cannot execute [Is a directory]
gawk: { ORS = "
gawk: ^ unterminated string
configure[138]: } /.rc$/ { gsub(.rc, .o, configure); print configure; }': not found [No such file or directory]
configure[139]: : cannot execute [Is a directory]
gawk: { ORS = "
gawk: ^ unterminated string
configure[139]: } { print configure; }': not found [No such file or directory]
--

At least, it determines the right awk (gawk in open solaris!) correctly, so when replacing the first line of configure to use /bin/bash, configure is fine.

Please make sure the syntax fits with the specified shell - one way or another.

Reported version: 0.7.2
Operating system: UNIX


This issue was imported from FlySpray: https://bugs.openttd.org/task/3076
@DorpsGek
Copy link
Member Author

DorpsGek commented Aug 1, 2009

Rubidium wrote:

The script is not a bash script per-se; it also runs with e.g. dash. I've got NO idea what kind of flavour of sh you are using.

My interpretation of the specifications for 'sh' in "The Single UNIX ® Specification, Version 2" (http://www.opengroup.org/onlinepubs/007908799/xcu/sh.html / http://www.opengroup.org/onlinepubs/007908799/xcu/chap2.html# tag_001) is that multiline " (double quoted) strings are allowed as well as multiline ` (backquoted) strings.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3076#comment6414

@DorpsGek
Copy link
Member Author

DorpsGek commented Aug 1, 2009

Nixx wrote:

Right you are. The bit with "multi line strings" is nonsense. Guessed to quickly, sorry.

The shell in opensolaris turns out to be actually ksh - whoops. That is different in Sol10 (and earlier), where /bin/sh is a traditional Bourne-Shell.

So, something there is incompatible with ksh. It might be related to some kind of escaping, as it is gawk that's complaining about an unterminated string that starts with a tab character (0x09).

Suggestion: If the shebang line named /bin/bash (or even dash), there are only two scenarios: shell is there - you can configure, or the shell isn't there - you immediately recognize where the problem is. I first blamed the awk chosen and tried to replace it, as it is gawk that throws the error. The problem with /bin/sh always is that you cannot rely on it supporting bash, dash, ksh or traditional Bourne-Shell syntax.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3076#comment6417

@DorpsGek
Copy link
Member Author

DorpsGek commented Aug 1, 2009

Rubidium wrote:

Does the attached patch (for trunk though it applies to 0.7.2 with some offsets and fuzziness) solve the issue?

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3076#comment6418

@DorpsGek
Copy link
Member Author

DorpsGek commented Aug 1, 2009

Nixx wrote:

Yes, though there is no $enable_builtin_depend in the 0.7.2 release and the line numbers differ. Your patch modified to apply without warnings against 0.7.2 is attached.

Thank you!

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3076#comment6419

@DorpsGek
Copy link
Member Author

DorpsGek commented Aug 1, 2009

Rubidium closed the ticket.

Reason for closing: Fixed

In r17026


This comment was imported from FlySpray: https://bugs.openttd.org/task/3076

@DorpsGek DorpsGek closed this as completed Aug 1, 2009
@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Build system labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant