|
From: <sv...@va...> - 2009-06-09 00:51:21
|
Author: njn
Date: 2009-06-09 01:50:45 +0100 (Tue, 09 Jun 2009)
New Revision: 10281
Log:
Abort if a --log-file filename begins with a '~'.
Modified:
trunk/coregrind/m_options.c
Modified: trunk/coregrind/m_options.c
===================================================================
--- trunk/coregrind/m_options.c 2009-06-09 00:10:20 UTC (rev 10280)
+++ trunk/coregrind/m_options.c 2009-06-09 00:50:45 UTC (rev 10281)
@@ -143,9 +143,21 @@
if (VG_STREQ(format, "")) {
// Empty name, bad.
- VG_(message)(Vg_UserMsg, "%s: filename is empty", option_name);
+ VG_UMSG("%s: filename is empty", option_name);
goto bad;
}
+
+ // If 'format' starts with a '~', abort -- the user probably expected the
+ // shell to expand but it didn't (see bug 195268 for details). This means
+ // that we don't allow a legitimate filename beginning with '~' but that
+ // seems very unlikely.
+ if (format[0] == '~') {
+ VG_UMSG("%s: filename begins with '~'", option_name);
+ VG_UMSG("You probably expected the shell to expand the '~', but it");
+ VG_UMSG("didn't. The rules for '~'-expansion vary from shell to shell.");
+ VG_UMSG("You might have more luck using $HOME instead.");
+ goto bad;
+ }
// If 'format' starts with a '/', do not prefix with startup dir.
if (format[0] != '/') {
|