|
From: | Zagorodnev, Grigory |
Subject: | RE: ar 2.10.91 and command scripts |
Date: | Fri, 13 Jul 2001 12:38:55 +0400 |
Thank you for the explanation!
The fix you provided looks good,
but I still need to know will this problem be fixed (I mean "officially") in the future versions of binutils or not?
Thanks,
Grigory.
-----Original Message-----
From: Eli Zaretskii [mailto:address@hidden]
Sent: Thursday, July 12, 2001 10:54 PM
To: address@hidden
Cc: address@hidden
Subject: Re: ar 2.10.91 and command scripts
> From: "Zagorodnev, Grigory" <address@hidden>
> Date: Thu, 12 Jul 2001 20:46:02 +0400
>
> address@hidden tmp]$ ar -M < script
> /usr/bin/ar: Can't open output archive tmp-./foo.a
>
> As I can see, reason of problem is in approach for temporary name creation.
> Previous versions of ar use template "%s-tmp" for name generation but now it
> is the "tmp-%s".
> According to note in ar source code it was done to support DOS-like file
> systems with 8.3 name format.
>
> Anyway, I want to ask couple questions:
> - Is this problem already known?
> - Is it already fixed in the latest versions?
No and no, at least this bug is stil in Binutils 2.11.
> - If not, are you going to fix it?
Please try the change below:
2001-07-12 Eli Zaretskii <address@hidden>
* arsup.c (ar_open): Prepend "tmp-" only to the file's basename.
--- binutils/arsup.c~0 Sun May 28 06:57:50 2000
+++ binutils/arsup.c Thu Jul 12 21:51:12 2001
@@ -160,10 +160,20 @@ DEFUN(ar_open,(name, t),
{
char *tname = (char *) xmalloc (strlen (name) + 10);
+ char *s = 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);
+ /* Prepend tmp- to the beginning of the file's basename, to avoid
+ file-name clashes after truncation on filesystems with limited
+ namespaces (DOS). */
+ while (*s && !IS_DIR_SEPARATOR (*s))
+ s++;
+ if (*s)
+ {
+ strncpy(tname, name, s - name);
+ sprintf(tname + (s - name), "%ctmp-%s", *s, s + 1);
+ }
+ else
+ sprintf(tname, "tmp-%s", name);
obfd = bfd_openw(tname, NULL);
if (!obfd) {
[Prev in Thread] | Current Thread | [Next in Thread] |