bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Version 1.13 'base_name()' misuse in 'rtapelib.c' breaks remote t ape ac


From: Roesinger Eric
Subject: Version 1.13 'base_name()' misuse in 'rtapelib.c' breaks remote t ape access.
Date: Wed, 25 Jul 2001 23:50:43 -0500

The release code appears to assume base_name() returns a pointer to '/'
before the basename, rather than to the basename itself.

If REMOTE_SHELL is defined, for example, to be '/usr/ucb/rsh', then the
resulting basename is 'sh', which doesn't match the expected 'rsh'.

Many (if not most) implementations of 'rsh' and similar programs take a
nonmatching 'argv[0]' to be an implied hostname. Typically, a host such
as 'sh' will not exist; and even if it did, it would not be the desired
host (except by coincidence).

To make matters even worse, the resulting error message:

   sh: unknown host
   tar (grandchild): Cannot open archive address@hidden:/dev/rmt/0m: I/O error
   tar (grandchild): Error is not recoverable: exiting now

is made even more unrevealing by the mangled name.

It's really surprising to find something like this in supposedly stable
code; and it may well have been fixed in the beta source. (I don't know,
since it was faster to find the bug than to retrieve the beta code)

Two options exist to resolve the problem:

  1. Simply remove the kludge on the result of 'base_name()'.

     This executes correctly, but still doesn't tell *which* host is
     unknown.

  2. Use the hostname as 'argv[0]' when 'exec()'ing the remote shell.

     This gives us the name of the host if it turns out to be unknown,
     but may be incompatible with some implementations.

I've chosen option '1', for compatibility. A context diff follows.

--
Eric  G  Roesinger : Member  Technical Staff  :  Thomson multimedia Inc.
   +1 317 587 3050 : Technology Applications  :  Americas HQ Tech Center
  FAX 317 587 6779 : Indpls IC Design Center  :  101 W 103rd St (INH700)
<address@hidden> : P.O. Box 6139,  Indianapolis,  IN  46206-6139 (USA)


*** rtapelib.c  Wed Jul 25 23:22:55 2001
--- rtapelib.c  Wed Jul  7 01:10:37 1999
***************
*** 414,420 ****
  #endif
        }
      remote_shell_basename = base_name (remote_shell);
!     if (!remote_shell_basename)
        remote_shell_basename = remote_shell;
 
      /* Set up the pipes for the `rsh' command, and fork.  */
--- 414,422 ----
  #endif
        }
      remote_shell_basename = base_name (remote_shell);
!     if (remote_shell_basename)
!       remote_shell_basename++;
!     else
        remote_shell_basename = remote_shell;
 
      /* Set up the pipes for the `rsh' command, and fork.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]