Amanda-Users

Re: sendbackup has a hardcoded call to gtar

2003-10-10 17:54:45
Subject: Re: sendbackup has a hardcoded call to gtar
From: Paul Bijnens <paul.bijnens AT xplanation DOT com>
To: Kirk Strauser <kirk AT strauser DOT com>
Date: Fri, 10 Oct 2003 23:49:36 +0200
Kirk Strauser wrote:
At 2003-10-10T20:23:32Z, Paul Bijnens <paul.bijnens AT xplanation DOT com> 
writes:

You have the source tarball, and the after unpacking it and reading the
docs/INSTALL, you usually do:

  ./configure --prefix=... --with-gnutar=...   ...

I'm familiar with that.

...
Yes, but it's not definable at all; the actual string "gtar" is coded into
the file.  I could understand if there was something like:

in config.h:

   #define GNUTAR_PROGRAM "gtar"

in sendbackup-gnutar.c

   #include "config.h"
   ...
   exec(GNUTAR_PROGRAM, arg1, arg2, ...)

But it's not that way at all.  The only way to configure that program is to
manually edit the file.

You're closer than you think!
You are probably confused by line 483 in sendbackup-gnutar.c:

  483         my_argv[i++] = "gtar";
  484         my_argv[i++] = "--create";
  485         my_argv[i++] = "--file";
  486         my_argv[i++] = "-";

But here is actually the commandline for "runtar" constructed.
The program "runtar" lives in libexec, and should be suid root.
It does some sanity checking on the args, and then execs in
line 95:

   95     execve(GNUTAR, argv, safe_env());

and GNUTAR is take from config/config.h, which is constructed
by the ./configure command, as explained above.
Just like you would like to have it.  :-)


A frequent trick is to compile with --with-gnutar=/usr/local/bin/amgtar.
And the "amgtar" command can be as simple as a symlink to the good version
of gnutar, or a shell script that creates a snapshot before running
gnutar, or shuts down databases etc.

And that would be a good thing to do, but if the command isn't named "gtar"
and isn't in amanda's $PATH, then I don't see that any number of options
passed to ./configure will make sendbackup execute your program.

Mine *is* called amgtar, and the full pathname is specified in config.h:

#define GNUTAR "/usr/local/bin/amgtar"

so that there is no need to put it in the PATH (okay, I admit, /usr/local/bin is in the PATH of the amanda user too, but it doesn't
need to be).

--
Paul @ Home


<Prev in Thread] Current Thread [Next in Thread>