View Issue Details

IDProjectCategoryView StatusLast Update
0000557MetaPostbugpublic2011-05-16 13:37
ReporterTacoAssigned ToTaco 
PrioritylowSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version1.504 
Summary0000557: bad basename discovery
DescriptionFrom Peb:

In mplibdir/mpost.w:1201ff (main) you say:
  if (strstr(argv[0], "dvitomp") != NULL) {
    dvitomp_only=1;
    @<Read and set dvitomp command line options@>;
  } else {
    @<Read and set command line options@>;
  }

I think this isn't robust for various reasons:
(A) Under Windows argv[0] might end with DVITOMP.EXE
(B) A symlink or copy with the (highly unrealistic) name Funny_dvitomp_Fake
    would be taken as dvitomp instead of mpost.

Instead I'd suggest this:
  {
    const char *base = xbasename(argv[0]);
    if (!strcmp(base, "dvitomp") || !strcasecmp(base, "dvitomp.exe"))
      dvitomp_only=1;
  }
  if (dvitomp_only) {
    @<Read and set dvitomp command line options@>;
  } else {
    @<Read and set command line options@>;
  }

This is still not perfect on a case insensitive Mac OS X filesystem, but
that is how it is now done in analogous cases.
TagsNo tags attached.

Activities

Taco

2011-02-09 16:18

administrator   ~0000737

in #1441 (trunk)

Issue History

Date Modified Username Field Change
2011-01-10 14:58 Taco New Issue
2011-01-10 14:58 Taco Status new => assigned
2011-01-10 14:58 Taco Assigned To => Taco
2011-02-09 16:18 Taco Note Added: 0000737
2011-02-09 16:18 Taco Status assigned => resolved
2011-02-09 16:18 Taco Resolution open => fixed
2011-05-16 13:37 Taco Fixed in Version => 1.504
2011-05-16 13:37 Taco Status resolved => closed