Bug 31069 - execve doesn't work correct in some cases
Summary: execve doesn't work correct in some cases
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.1.1
: P3 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-07 12:30 UTC by Bernd Krumböck
Modified: 2007-03-07 15:27 UTC (History)
1 user (show)

See Also:
Host: ia64-hp-hpux11.23
Target: ia64-hp-hpux11.23
Build: ia64-hp-hpux11.23
Known to work:
Known to fail:
Last reconfirmed:


Attachments
example code to reproduce the problem (760 bytes, text/plain)
2007-03-07 12:33 UTC, Bernd Krumböck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd Krumböck 2007-03-07 12:30:05 UTC
This bug only occurs with gcc 4.x.x on hpux.

In certain circumstances the parameter for the environment will be assigned as argument for the command.

I've written some code which will show you the exact problem. You need openssl to reproduce this test.


The expected output is:
Generating a 1024 bit RSA private key
.......................................++++++
....................................++++++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:State or Province Name (full name) [Some-State]:Locality Name (eg, city) []:Organization Name (eg, company) [Internet Widgits Pty Ltd]:Organizational Unit Name (eg, section) []:Common Name (eg, YOUR name) []:Email Address []:



The same program compiled with gcc 4.x.x:
unknown option MYVAR=TEST
req [options] <infile >outfile
where options  are
 -inform arg    input format - DER or PEM
 -outform arg   output format - DER or PEM
 -in arg        input file
 -out arg       output file
 -text          text form of request
 -pubkey        output public key
 -noout         do not output REQ
 -verify        verify signature on REQ
 -modulus       RSA modulus
 -nodes         don't encrypt the output key
 -engine e      use engine e, possibly a hardware device
 -subject       output the request's subject
 -passin        private key password source
 -key file      use the private key contained in file
 -keyform arg   key file format
 -keyout arg    file to send the key to
 -rand file:file:...
                load the file (or the files in the directory) into
                the random number generator
 -newkey rsa:bits generate a new RSA key of 'bits' in size
 -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'
 -[digest]      Digest to sign with (md5, sha1, md2, mdc2, md4)
 -config file   request template file.
 -subj arg      set or modify request subject
 -new           new request.
 -batch         do not ask anything during request generation
 -x509          output a x509 structure instead of a cert. req.
 -days          number of days a certificate generated by -x509 is valid for.
 -set_serial    serial number to use for a certificate generated by -x509.
 -newhdr        output "NEW" in the header lines
 -asn1-kludge   Output the 'request' in a format that is wrong but some CA's
                have been reported as requiring
 -extensions .. specify certificate extension section (override value in config file)
 -reqexts ..    specify request extension section (override value in config file)
 -utf8          input characters are UTF8 (default ASCII)
 -nameopt arg    - various certificate name options
 -reqopt arg    - various request text options


best regards!
Bernd
Comment 1 Bernd Krumböck 2007-03-07 12:33:31 UTC
Created attachment 13161 [details]
example code to reproduce the problem
Comment 2 Richard Biener 2007-03-07 14:34:35 UTC
Your argv array is too small.
Comment 3 Bernd Krumböck 2007-03-07 15:27:43 UTC
Oh, you're right! Thank you!

I tried to debug for 3 days, without success.
Linux, HPUX, GCC 4.X and GCC 3.4.2, .....

You are a hero!
Once again, thank you very much.


PS: Sorry for wasting your time.

best regards!
Bernd