|
From: Nicholas N. <nj...@ca...> - 2003-08-11 12:02:45
|
Hi, I've found a problem with Valgrind's handling of quoted command line arguments. It's pretty obscure, I guess that's why nobody's complained before. Compare these two commands, with and without Valgrind: [~/grind/massif] echo "foo -> bar" | sed -e 's/^.* -> /b/' bbar [~/grind/massif] echo "foo -> bar" | valgrind sed -e 's/^.* -> /b/' ==26593== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux. ==26593== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward. ==26593== Using valgrind-20030716, a program supervision framework for x86-linux. ==26593== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward. ==26593== Estimated CPU clock rate is 1404 MHz ==26593== For more details, rerun with: -v ==26593== sed: -e expression #1, char 5: Unterminated `s' command ==26593== ==26593== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==26593== malloc/free: in use at exit: 4884 bytes in 3 blocks. ==26593== malloc/free: 44 allocs, 41 frees, 9247 bytes allocated. ==26593== For a detailed leak analysis, rerun with: --leak-check=yes ==26593== For counts of detected errors, rerun with: -v The problem is the spaces in the quoted string; the string gets broken up into 3 arguments; this happens in the "valgrind" startup script. I've tried to stop this, fiddling with the quotes, using $* instead of $@, but it's beyond my understanding of shell quoting rules. Does anyone have any suggestions? Thanks. N |