-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include of ASM sources behaves oddly on Linux #31
Comments
Hi Steven, |
I will have to double-check, but my impression is that the Windows build of zasm does not behave in the the same manner as the Linux code. |
Definitely a difference in behavior. Here's a test case. Unzip this under both Windows and Linux.
|
hm, it's the windows version which behaves wrong. as i said, i don't own a windows computer so i can not easily test it. the problem is that the different path separator should be handled by cygwin (if you compile with cygwin) but it isn't. it's probably 10++ years too late to fix this... a quick search tells me, that most windows api accept "/" as well. So zasm could replace all incoming "\" with "/". eventually you can call zasm in a subdirectory using the forward slash. then the paths should resolve just as under unix. |
@Megatokio you can tag me for questions about cygwin, i'll be happy to fix bugs and rebuild. |
I have prepared a small patch that fixes this bug. I apologize if the error output is not correct, I do not know how it should be correct, but I know for sure that errno contains an error code when converting the path. diff --git a/Source/main.cpp b/Source/main.cpp
index 443c8bf..48d0e7d 100644
--- a/Source/main.cpp
+++ b/Source/main.cpp
@@ -46,6 +46,9 @@
#include <sys/stat.h>
#include <unistd.h>
+#ifdef __CYGWIN__
+ #include <sys/cygwin.h>
+#endif
// static const char appl_name[] = "zasm";
#define VERSION "4.4.11"
@@ -130,10 +133,17 @@ static cstr help() { return catstr(usingstr(version, compiledatestr()), syntax,
static cstr posix_path(cstr s) // 4.4.11
{
#ifdef __CYGWIN__
- // fix directory separator under Cygwin (Windows):
- s = replacedstr(s, '\\', '/');
-#endif
+ static char cyg_path[PATH_MAX];
+ if (cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_RELATIVE, s, cyg_path, PATH_MAX))
+ {
+ log("--> convert path %s failed: %s\nzasm: 1 error\n", s, strerror(errno));
+ exit(1);
+ }
+
+ return cyg_path;
+#else
return s;
+#endif
}
static void read_testdir(cstr path, Array<cstr>& filepaths) I'm also attaching a win64 binary for testing: |
Hi Turbocat, I pushed version 4.4.12 which includes your fix with a correction: The use of |
@Megatokio It's OK. I might have noticed this error earlier... Checked and compiled. Everything is working. However, I have a question. Does using PS: |
Thanks for the binaries, they are already on the project website at k1.spdns.de. :-)
|
I'm working with a vintage Z80 project where files in a subdirectory are built by specifying relative paths, e.g.
The source asm file has an
#include CPM22.asm
pseudo-op. That included file lives in the current working directory (parent of 'config'). Under Linux, zasm is only able to see the included file if its present in the 'config' directory. Based on comments from the project owner, it appears the Windows port of zasm is able to find the file in the current directory. I tried specifying-I .
but that did not work. Am I missing something or is this a bug?The text was updated successfully, but these errors were encountered: