Skip to content

Conversation

khwilliamson
Copy link
Contributor

Configure conflated the file 'cppstdin' and the variable $cppstdin, failing to initialize the latter.

It also overrode the hints file wrapper for feeding stdin to the C preprocessor. It did this without asking, but ran a simple test, and if it passed, did the override. This behavior dates to the mid 1990s. The problem is that on z/OS the simple test passes, but not all inputs do.

Some system header files on z/OS have C trigraphs, which cause modern compilers to warn about them. The hints file wrapper, which dates from the late 1990's, did an "fgrep -v" to get rid of them, but it doesn't end up getting used. The simple test that Configure ends up of course would not think to try trigraphs. (There may be other issues as well, but this one really pops out.)

This commit initializes $cppstdin, and doesn't try to override a furnished cppstdin from the hints.

  • This set of changes does not require a perldelta entry.

Configure conflated the file 'cppstdin' and the variable $cppstdin,
failing to initialize the latter.

It also overrode the hints file wrapper for feeding stdin to the C
preprocessor.  It did this without asking, but ran a simple test, and if
it passed, did the override.  This behavior dates to the mid 1990s.  The
problem is that on z/OS the simple test passes, but not all inputs do.

Some system header files on z/OS have C trigraphs, which cause modern
compilers to warn about them.  The hints file wrapper, which dates from
the late 1990's, did an "fgrep -v" to get rid of them, but it doesn't
end up getting used.  The simple test that Configure ends up of course
would not think to try trigraphs.  (There may be other issues as well,
but this one really pops out.)

This commit initializes $cppstdin, and doesn't try to override a
furnished cppstdin from the hints.
@khwilliamson khwilliamson requested review from tonycoz and Tux September 4, 2025 03:37
@tonycoz
Copy link
Contributor

tonycoz commented Sep 4, 2025

looks like some cleanup or filtering is missing:

# There are uncommitted changes in the working directory
# ?? cppstdin
# 

@khwilliamson
Copy link
Contributor Author

It looks like this is a victim of bit rot. cppstdin is used as a variable in a few places to indicate what to eval to feed stdin to the C preprocessor. When set to point to a file that file contains the commands. In grepping through the source, this appears to be the only place where a file is used. The comments in hints/os390.sh say

We have our own cppstdin script. This is not a variable since
Configure sees the presence of the script file.
We put system header -D definitions in so that Configure
can find the shmat() prototype in <sys/shm.h> and various
other things. Unfortunately, cppflags occurs too late to be of
value external to the script. This may need to be revisited

I don't understand what that all means.

Errno looks to see if it is an actual file.

sub default_cpp {
    unless (defined $cppstdin) {
	use File::Spec;
	$cppstdin = $Config{cppstdin};
	my $upup_cppstdin = File::Spec->catfile(File::Spec->updir,
						File::Spec->updir,
						"cppstdin");
	my $cppstdin_is_wrapper =
	    ($cppstdin eq 'cppstdin'
		and -f $upup_cppstdin
		    and -x $upup_cppstdin);
	$cppstdin = $upup_cppstdin if $cppstdin_is_wrapper;
    }
    return "$cppstdin $Config{cppflags} $Config{cppminus}";
}

So, this is supposed to be able to be a file, but all but this usage of it has been removed, and this one got broken without anyone noticing. I can try to make this into just a variable, I suppose.

@Tux, any ideas?

@jkeenan
Copy link
Contributor

jkeenan commented Sep 6, 2025

When I try to build from this branch, ./Configure hangs indefinitely here:

Checking for GNU cc in disguise and/or its version number...
Now, how can we feed standard input to your C preprocessor...

@tonycoz
Copy link
Contributor

tonycoz commented Sep 8, 2025

When I try to build from this branch, ./Configure hangs indefinitely here:

It's probably waiting for end of file (Ctrl-D)

@jkeenan
Copy link
Contributor

jkeenan commented Sep 9, 2025

When I try to build from this branch, ./Configure hangs indefinitely here:

It's probably waiting for end of file (Ctrl-D)

Well, I've never seen this before in all the thousands of times I've run Ctrl-D.

@khwilliamson
Copy link
Contributor Author

This is pretty complicated; I imagine it will have to wait until @Tux gets a chance to grok it and discuss it with me

@tonycoz
Copy link
Contributor

tonycoz commented Sep 9, 2025

Well, I've never seen this before in all the thousands of times I've run Ctrl-D.

"Run Configure" I hope :)

But you did get a "waiting for input" hang in Configure once before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants