public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: rep.dot.nop@gmail.com, Richard Biener <rguenther@suse.de>,
	Alexandre Oliva <oliva@gnu.org>,
	Giuliano Belinassi <gbelinassi@suse.de>,
	matz@suse.com
Subject: Re: [PATCH] Do not abort compilation when dump file is /dev/*
Date: Fri, 19 Nov 2021 13:25:31 +0100	[thread overview]
Message-ID: <20211119132531.6ac44ea4@nbbrfq> (raw)
In-Reply-To: <r9pp2948-p61n-7018-45sp-77886667pn1q@fhfr.qr>

On Fri, 19 Nov 2021 10:35:26 +0100 (CET)
Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:

> On Fri, 19 Nov 2021, Alexandre Oliva wrote:
> 
> > On Nov 18, 2021, Richard Biener <rguenther@suse.de> wrote:
> >   
> > > IMHO a more reasonable thing to do would be to not treat
> > > -o /dev/null as a source for -dumpdir and friends.  Alex?  
> > 
> > +1
> > 
> > I think we already have some special-casing for /dev/null somewhere.  
> 
> Grepping finds me the following in system.h which is already checked
> for in gcc.c in a few places indeed.
> 
> /* Provide a default for the HOST_BIT_BUCKET.
>    This suffices for POSIX-like hosts.  */
> 
> #ifndef HOST_BIT_BUCKET
> #define HOST_BIT_BUCKET "/dev/null"
> #endif
> 
> 
> > > You did the last re-org, where'd we put such special casing?  
> > 
> > I think we're missing something like this, to avoid messing with dumpdir
> > with -o /dev/null.  We already use the same function when computing
> > outbase just below this.  
> 
> Ah yeah, not_actual_file_p should do the trick indeed.  Giuliano, can
> you update the patch like below?  I think we should still adjust
> documentation as you did.

But that wouldn't cater for the general problem that the dumpdir is not
writable, no? Why not just simply check access W_OK of the dumpdir?

Otherwise a dumpdir /dev/full or anyother such path will cause the same
thing i guess.

thanks,
> 
> > diff --git a/gcc/gcc.c b/gcc/gcc.c
> > index 506c2acc282d6..a986728fb91d6 100644
> > --- a/gcc/gcc.c
> > +++ b/gcc/gcc.c
> > @@ -5098,7 +5098,8 @@ process_command (unsigned int decoded_options_count,
> >  
> >    bool explicit_dumpdir = dumpdir;
> >  
> > -  if (!save_temps_overrides_dumpdir && explicit_dumpdir)
> > +  if ((!save_temps_overrides_dumpdir && explicit_dumpdir)
> > +      || (output_file != NULL && not_actual_file_p (output_file)))
> >      {
> >        /* Do nothing.  */
> >      }
> >   


  reply	other threads:[~2021-11-19 12:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 16:52 Giuliano Belinassi
2021-11-18  9:43 ` Richard Biener
2021-11-18 12:52   ` Giuliano Belinassi
2021-11-18 14:24     ` Richard Biener
2021-11-18 21:35       ` [PATCH v2] " Giuliano Belinassi
2021-11-19  8:11         ` Richard Biener
2021-11-19  9:22   ` [PATCH] " Alexandre Oliva
2021-11-19  9:35     ` Richard Biener
2021-11-19 12:25       ` Bernhard Reutner-Fischer [this message]
2021-11-19 12:51         ` Richard Biener
2021-11-19 13:42     ` [PATCH v3] " Giuliano Belinassi
2021-11-19 14:12       ` Richard Biener
2021-11-19 14:47         ` Bernhard Reutner-Fischer
2021-11-21  3:47         ` Alexandre Oliva
2021-11-22 12:35           ` Giuliano Belinassi
2021-11-18 11:48 ` [PATCH] " Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211119132531.6ac44ea4@nbbrfq \
    --to=rep.dot.nop@gmail.com \
    --cc=gbelinassi@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=matz@suse.com \
    --cc=oliva@gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).