This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Fix ar -M


On Fri, Oct 19, 2001 at 03:47:24PM -0400, DJ Delorie wrote:
> 
> > To fix this, either we don't care what the temporary name exactly is
> 
> I think we do.  It should be on the same filesystem so it can be
> renamed later.

make_tempname gives name in the same directory too, but if you prefer
prefixing with tmp-, here it is (includes Earl's arlex.l change).
Ok to commit?

2001-10-19  Jakub Jelinek  <jakub@redhat.com>

	* arlex.l: Accept `\' in filenames.  Patch by <earl_chew@agilent.com>.

	* arsup.c (ar_open): Prepend tmp- to basename, not whole path.

--- binutils/arsup.c.jj	Mon Mar 26 19:44:29 2001
+++ binutils/arsup.c	Fri Oct 19 22:10:16 2001
@@ -160,10 +160,11 @@ DEFUN(ar_open,(name, t),
 
 {
   char *tname = (char *) xmalloc (strlen (name) + 10);
+  const char *bname = lbasename (name);
   real_name = name;
   /* Prepend tmp- to the beginning, to avoid file-name clashes after
      truncation on filesystems with limited namespaces (DOS).  */
-  sprintf(tname, "tmp-%s", name);
+  sprintf(tname, "%.*stmp-%s", (int) (bname - name), name, bname);
   obfd = bfd_openw(tname, NULL);
 
   if (!obfd) {
--- binutils/arlex.l.jj	Mon Mar 26 19:44:29 2001
+++ binutils/arlex.l	Fri Oct 19 22:13:50 2001
@@ -71,7 +71,7 @@ int linenumber;
 "("             { return '('; }
 ")"             { return ')'; }
 ","             { return ','; }
-[A-Za-z0-9/$:.\-\_]+  { 	
+[A-Za-z0-9/\\$:.\-\_]+  { 	
 		yylval.name =  xstrdup (yytext);
 		return FILENAME;
 		}


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]