Browse thread
Bug in Filename.basename?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-09-05 (11:10) |
From: | Erik de Castro Lopo <mle+ocaml@m...> |
Subject: | Re: [Caml-list] Bug in Filename.basename? |
Richard Jones wrote: > I think the OCaml one is what I'd reasonably expect actually. > > The GNU documentation for basename says: > > `basename' removes any leading directory components from NAME. > > and a/b/c/ are leading directory components. The word "leading" in the above is at best, ambiguous. Regardless of what the documentation says, the behaviour of Ocaml's basename function is different from the basename program (from the GNU coreutils package) on my Linux system. Since I suspect that the basename function is meant to emulate the basename program I see the Ocaml function's behaviour as a bug. I would however discount this if the behaviour of basename on some other commonly used system (eg *BSD) matched the Ocaml behaviour. However, here is a comparison chart of what I have tested so far: "a/b/c" "a/b/c/" Linux basename "c" "c" Mac OSX basename "c" "c" Ocaml Filename.basename "c" "." The behaviour of Ocaml's Filename.basename is the same on Linux and Mac OSX. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- http://en.wikipedia.org/wiki/Why_I_Am_Not_a_Christian http://en.wikipedia.org/wiki/Why_I_Am_Not_a_Muslim http://en.wikipedia.org/wiki/Strong_atheism