[htdig] Re: Shell Quoting/Escaping (PR#872)


Subject: [htdig] Re: Shell Quoting/Escaping (PR#872)
From: Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Date: Tue Jul 11 2000 - 10:13:01 PDT


According to Tudor Hulubei (tudor.hulubei@ecora.com):
> I bumped into some shell quotation problems with htdig-3.1.5.
> None of the shell invocations (look for popen calls) seem to
> properly quote the arguments, which results in incorrect behaviour
> when the files/directories passed as parameters have spaces in them.
>
> This patch fixes the problem in one place, but there are other places
> where the same kind of change should be implemented...

Thanks for the report and patch! This code is no longer used in 3.2, and
a future 3.1 release is unlikely, so about all I can do is post this to
the list so it gets archived for use by others who run into this problem.

We should, however, look for other similar trouble spots in the 3.2 code.
(And we'd gladly receive any 3.2 patches! :-)

You may find that directory names with spaces, particularly temporary
directories, may cause problems in other programs too, so my advice would
be to avoid these whenever possible.

diff -rcPp2 htdig-3.1.5/htmerge/words.cc
/usr/src/redhat/BUILD/htdig-3.1.5/htmerge/words.cc
*** htdig-3.1.5/htmerge/words.cc Thu Feb 24 21:29:11 2000
--- /usr/src/redhat/BUILD/htdig-3.1.5/htmerge/words.cc Fri Jul 7 16:05:34 2000
*************** mergeWords(char *wordtmp, char *wordfile
*** 60,66 ****
      if (tmpdir.length())
      {
! command << " -T " << tmpdir;
      }
! command << ' ' << wordtmp;
      FILE *sorted = popen(command, "r");
      if (!sorted)
--- 60,66 ----
      if (tmpdir.length())
      {
! command << " -T \"" << tmpdir << "\"";
      }
! command << ' ' << "\"" << wordtmp << "\"";
      FILE *sorted = popen(command, "r");
      if (!sorted)

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig mailing list, send a message to htdig-unsubscribe@htdig.org You will receive a message to confirm this.



This archive was generated by hypermail 2b28 : Tue Jul 11 2000 - 07:28:48 PDT