#5099 [file normalize] fails EIAS

obsolete: 8.6b2
closed-fixed
Don Porter
5
2012-08-20
2012-08-20
phao
No

Command/subcommand file normalize won't normalize some elements of glob's path list.

The expected behavior is to have that trailing '/' character removed, and it is not being removed.

Here is some small code (output commented in the end): [http://pastie.org/4552920].

However, if I ask for the string length of the list element, then it works: [http://pastie.org/4552993].

That a simple test case provided by kbk in IRC (#tcl, irc.freenode.com).

[22:38] <ijchain> <kbk> % file normalize [lindex [glob -dir [pwd] {{}}] 0]
[22:38] <ijchain> <kbk> /home/kennykb/fred/
[22:38] <ijchain> <kbk> % file normalize [join [glob -dir [pwd] {{}}] ""]
[22:38] <ijchain> <kbk> /home/kennykb/fred

I am on Windows 7, TCL Version is 8.6b2.

Discussion

1 2 > >> (Page 1 of 2)
  • Kevin B KENNY
    Kevin B KENNY
    2012-08-20

    • assigned_to: vincentdarley --> dgp
     
  • Kevin B KENNY
    Kevin B KENNY
    2012-08-20

    Regression in 8.5 appears to be related to refactoring in tclPathObj.c. Tentatively assigning to dgp for analysis, since Vince isn't terribly active at the moment.

     
  • Don Porter
    Don Porter
    2012-08-20

    • summary: cmd/sub file normalize won't do in glob's result --> [file normalize] fails EIAS
     
  • Don Porter
    Don Porter
    2012-08-20

    Aside from the EIAS bug, can someone testify that [glob]
    is returning the correct list of results?

     
  • Don Porter
    Don Porter
    2012-08-20

    The pattern "{}" is the empty set of alternative strings to match.
    Maybe my brain is still on vacation, but I'd expect that to match nothing.
    Simplest test, though:
    % glob {{}}
    .

     
  • Don Porter
    Don Porter
    2012-08-20

    Some spot testing suggests this is not a new regression.

     
  • Don Porter
    Don Porter
    2012-08-20

    Regression dates to checkin:

    9cfcca63fb07d8c7d68befc16d84d01790094ac5 2004-01-21 19:59:32 UTC

     
  • Don Porter
    Don Porter
    2012-08-20

    Curious to me that the -dir switch is needed to trigger
    the problem. [pwd] isn't though.

    % file normalize [lindex [glob -dir . {{}}] 0]
    /local/tmp/dgp/fossil/tcl8.5/unix/
    % info patch
    8.5.12

     
  • Don Porter
    Don Porter
    2012-08-20

    Issue appears to be callers of TclNewFSPathObj() not
    honoring its requirements. Header comments state clearly
    that 'len' may not be zero.

     
  • Don Porter
    Don Porter
    2012-08-20

    On further reflection, the empty string corner case for
    paths and path components have been pushed here and
    there so many times in intermittent games of "stomp the
    bug" we're better off not trusting the comments.

    Fix committed to core-8-5-branch

     
1 2 > >> (Page 1 of 2)