public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Alan Modra via Binutils <binutils@sourceware.org>,
	Paul Naidoo <paul.naidoo@lynkeos.co.uk>
Subject: Re: `strip: X.so could not create temporary file to hold stripped copy: cause of error unknown`
Date: Wed, 22 Feb 2023 12:05:05 +1030	[thread overview]
Message-ID: <Y/VxSeAdavwMeSFA@squeak.grove.modra.org> (raw)
In-Reply-To: <87y1oq4kdi.fsf@igel.home>

On Wed, Feb 22, 2023 at 01:24:57AM +0100, Andreas Schwab wrote:
> On Feb 22 2023, Alan Modra via Binutils wrote:
> 
> > On Tue, Feb 21, 2023 at 08:43:56PM +0000, Paul Naidoo wrote:
> >> |strip --remove-section=.note.ABI-tag
> >> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5|
> >> 
> >> However executing the command returns the error: |strip:
> >> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: could not create temporary file
> >> to hold stripped copy: cause of error unknown|
> >
> > You don't have write access in /usr/lib/x86_64-linux-gnu/.
> 
> I think this will improve the error message:
> 
> diff --git a/binutils/objcopy.c b/binutils/objcopy.c
> index cf830442b3c..98c567bd955 100644
> --- a/binutils/objcopy.c
> +++ b/binutils/objcopy.c
> @@ -4884,6 +4884,7 @@ strip_main (int argc, char *argv[])
>  
>        if (tmpname == NULL)
>  	{
> +	  bfd_set_error (bfd_error_system_call);
>  	  bfd_nonfatal_message (argv[i], NULL, NULL,
>  				_("could not create temporary file to hold stripped copy"));
>  	  status = 1;

Yes, or even better:

	* bucomm.c (make_tempname, make_tempdir): Set bfd_error on error.

diff --git a/binutils/bucomm.c b/binutils/bucomm.c
index df60ce06547..c268fd3d913 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -555,6 +555,7 @@ make_tempname (const char *filename, int *ofd)
   if (fd == -1)
     {
       free (tmpname);
+      bfd_set_error (bfd_error_system_call);
       return NULL;
     }
   *ofd = fd;
@@ -583,7 +584,10 @@ make_tempdir (const char *filename)
 #endif
 #endif
   if (ret == NULL)
-    free (tmpname);
+    {
+      free (tmpname);
+      bfd_set_error (bfd_error_system_call);
+    }
   return ret;
 }
 

-- 
Alan Modra
Australia Development Lab, IBM

      reply	other threads:[~2023-02-22  1:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 20:43 Paul Naidoo
2023-02-22  0:02 ` Alan Modra
2023-02-22  0:24   ` Andreas Schwab
2023-02-22  1:35     ` Alan Modra [this message]

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=Y/VxSeAdavwMeSFA@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=paul.naidoo@lynkeos.co.uk \
    --cc=schwab@linux-m68k.org \
    /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).