From: "Charles Day" <cedayiv@gmail.com>
To: bug-guile@gnu.org
Subject: dirname & basename not working on mingw
Date: Mon, 21 Jan 2008 15:01:26 -0800 [thread overview]
Message-ID: <1d6843d80801211501n7c50cfddw9dc9dbf34a9fb549@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
Hello,
This is my first post to any guile list. I write because I am using
Guile 1.6.8 on mingw, and the dirname and basename procedures don't
work properly. I tried a few variations:
(dirname "abc/def") returns "."
(dirname "abc\\def") returns "."
(dirname "c:/abc/def") returns "."
(dirname "c:\\abc\\def") returns "."
(dirname "/c/abc/def") returns "/"
So I had a look at the source code in libguile/filesys.c and I think
I've found the bug - and it's definitely of the "oops!" variety. I've
attached a patch that should fix the problem for 1.6.8. If you agree,
please take a look at whether this affects other versions too.
Cheers,
Charles
[-- Attachment #2: filesys.txt --]
[-- Type: text/plain, Size: 665 bytes --]
--- filesys.c.old Thu Jun 9 15:42:54 2005
+++ filesys.c Mon Jan 21 14:34:47 2008
@@ -1413,7 +1413,7 @@
i = len - 1;
#ifdef __MINGW32__
while (i >= 0 && (s[i] == '/' || s[i] == '\\')) --i;
- while (i >= 0 && (s[i] != '/' || s[i] != '\\')) --i;
+ while (i >= 0 && s[i] != '/' && s[i] != '\\') --i;
while (i >= 0 && (s[i] == '/' || s[i] == '\\')) --i;
#else
while (i >= 0 && s[i] == '/') --i;
@@ -1470,7 +1470,7 @@
if (j == -1)
end = i;
#ifdef __MINGW32__
- while (i >= 0 && (f[i] != '/' || f[i] != '\\')) --i;
+ while (i >= 0 && f[i] != '/' && f[i] != '\\') --i;
#else
while (i >= 0 && f[i] != '/') --i;
#endif /* ndef __MINGW32__ */
next reply other threads:[~2008-01-21 23:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 23:01 Charles Day [this message]
2008-01-24 22:23 ` dirname & basename not working on mingw Neil Jerram
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d6843d80801211501n7c50cfddw9dc9dbf34a9fb549@mail.gmail.com \
--to=cedayiv@gmail.com \
--cc=bug-guile@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).