public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error
[not found] <bug-19089-4@http.gcc.gnu.org/bugzilla/>
@ 2021-11-28 2:02 ` pinskia at gcc dot gnu.org
2021-11-28 2:16 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-28 2:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19089
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I can't reproduce the crash any more but it should not be hard to fix.
The problem is in make-temp-file.c where we do:
static inline const char *
try_dir (const char *dir, const char *base)
{
if (base != 0)
return base;
if (dir != 0
&& access (dir, R_OK | W_OK | X_OK) == 0)
return dir;
return 0;
}
But we don't check to see if the dir is actually a directory.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error
[not found] <bug-19089-4@http.gcc.gnu.org/bugzilla/>
2021-11-28 2:02 ` [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error pinskia at gcc dot gnu.org
@ 2021-11-28 2:16 ` pinskia at gcc dot gnu.org
2021-11-28 2:52 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-28 2:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19089
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Something like after the access check has passed:
#ifdef S_ISDIR
struct stat s;
if (stat(dir, &s) <0)
return NULL;
if (!S_ISDIR (s.st_mode))
return NULL;
#endif
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error
[not found] <bug-19089-4@http.gcc.gnu.org/bugzilla/>
2021-11-28 2:02 ` [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error pinskia at gcc dot gnu.org
2021-11-28 2:16 ` pinskia at gcc dot gnu.org
@ 2021-11-28 2:52 ` pinskia at gcc dot gnu.org
2021-11-29 0:43 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-28 2:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19089
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2021-Novembe
| |r/585591.html
Keywords| |patch
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585591.html
The only issue is hosts where S_ISDIR is not defined (I don't think there is
any left but it least it will just fail like it used to).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error
[not found] <bug-19089-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2021-11-28 2:52 ` pinskia at gcc dot gnu.org
@ 2021-11-29 0:43 ` cvs-commit at gcc dot gnu.org
2021-11-29 0:44 ` pinskia at gcc dot gnu.org
2022-11-28 22:59 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-29 0:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19089
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:68332ab7ec58a89660db82569c5f4c2251d59741
commit r12-5568-g68332ab7ec58a89660db82569c5f4c2251d59741
Author: Andrew Pinski <apinski@marvell.com>
Date: Sat Nov 27 18:16:50 2021 -0800
Fix PR 19089: Environment variable TMP may yield gcc: abort
Even though I cannot reproduce the ICE any more, this is still
a bug. We check already to see if we can access the directory
but never check to see if the path is actually a directory.
This adds the check and now we reject the file as not usable
as a tmp directory.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
libiberty/ChangeLog:
* make-temp-file.c (try_dir): Check to see if the dir
is actually a directory.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error
[not found] <bug-19089-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2021-11-29 0:43 ` cvs-commit at gcc dot gnu.org
@ 2021-11-29 0:44 ` pinskia at gcc dot gnu.org
2022-11-28 22:59 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-29 0:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19089
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed. Sorry it took so long in fixing this issue.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error
[not found] <bug-19089-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2021-11-29 0:44 ` pinskia at gcc dot gnu.org
@ 2022-11-28 22:59 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19089
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/19089] New: Environment variable TMP may yield gcc: abort with internal error
@ 2004-12-20 12:44 m at verified dot de
2004-12-20 12:49 ` [Bug other/19089] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: m at verified dot de @ 2004-12-20 12:44 UTC (permalink / raw)
To: gcc-bugs
When a (bash) environment variable TMP is set to a file with execution
rights 0755, gcc aborts with an internal error. E.g.:
# -- bash shell --------------------------------------------------------------
$ uname -a
CYGWIN_NT-5.1 DF8JLP0J 1.5.5(0.94/3/2) 2003-09-20 16:31 i686 unknown unknown Cygwin
$ gcc --version
gcc (GCC) 3.3.1 (cygming special)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cat a.c
#include <stdlib.h>
#include <stdio.h>
int main(int argc , char *argv[]){
printf("Ok.\n");
return 0;
}
$ unset TMP
$ gcc -save-temps a.c
$ touch /tmp/file.txt
$ export TMP=/tmp/file.txt
$ gcc -save-temps a.c
$ chmod u+x /tmp/file.txt
$ gcc -save-temps a.c
$ chmod 0755 /tmp/file.txt
$ gcc -save-temps a.c
gcc: Internal error: Aborted (program collect2)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
## ----------------------------------------------------------
The MAN page does not note a dependency to TMP (only TMPDIR) ist listed.
--
Summary: Environment variable TMP may yield gcc: abort with
internal error
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: m at verified dot de
CC: gcc-bugs at gcc dot gnu dot org,m at verified dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19089
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-11-28 22:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-19089-4@http.gcc.gnu.org/bugzilla/>
2021-11-28 2:02 ` [Bug other/19089] Environment variable TMP may yield gcc: abort with internal error pinskia at gcc dot gnu.org
2021-11-28 2:16 ` pinskia at gcc dot gnu.org
2021-11-28 2:52 ` pinskia at gcc dot gnu.org
2021-11-29 0:43 ` cvs-commit at gcc dot gnu.org
2021-11-29 0:44 ` pinskia at gcc dot gnu.org
2022-11-28 22:59 ` pinskia at gcc dot gnu.org
2004-12-20 12:44 [Bug c/19089] New: " m at verified dot de
2004-12-20 12:49 ` [Bug other/19089] " pinskia at gcc dot gnu dot org
2004-12-20 13:01 ` pinskia at gcc dot gnu dot org
2005-07-02 1:48 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).