help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Building GNU Smalltalk-2.3.5 with MinGW


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Building GNU Smalltalk-2.3.5 with MinGW
Date: Mon, 18 Jun 2007 17:31:13 +0200
User-agent: Thunderbird 2.0.0.4 (Macintosh/20070604)


Object: FileStream error: could not open
C:\msys\1.0\home\faa59\Smalltalk_gnu\smalltalk-2.3.5/C:/msys/1.0/home/fa
a59/Smalltalk_gnu/smalltalk-2.3.5/kernel/AbstNamespc.st

You should find out how the problematic path is built (see kernel/MethodInfo.st as well as examples/Publish.st). You can try

(AbstractNamespace >> #superspace) methodSourceCode fileName

to see if the bad path is generated by GNU Smalltalk itself, or rather by something in kernel/File.st or kernel/Directory.st (in which case there is something more to fix there). I tried the obvious test:

Directory append: 'C:/msys/1.0/home/faa59/Smalltalk_gnu/smalltalk-2.3.5/kernel/AbstNamespc.st' to: 'C:\msys\1.0\home\faa59\Smalltalk_gnu\smalltalk-2.3.5'

but it gave correctly 'C:/msys/1.0/home/faa59/Smalltalk_gnu/smalltalk-2.3.5/kernel/AbstNamespc.st'

Could you check instead if "sed b < foo > bar" has the same effect as
"unix2dos"?

Unfortunately not - no \r characters are added to the lines and so the
tests still fail. However the Windows putchar() function intercepts a
bare \n and substitutes \r\n so the following piece of C code will do
the conversion on windows and leave things unchanged on unix:

Okay, then I prefer stripping \r from GNU Smalltalk's output. :-)

modifying _gst_set_file_access_times to use the appropriate Windows
API function

Windows provides an implementation of the POSIX utime() function which
should do the job for us. I notice the current code uses utimes() rather
than utime() - is utimes() generally more widely available or is this
usage purely for historical reasons?

utime provides only 1-second resolution. That's fine for GNU Smalltalk though.

The attached patch (to be applied on top of the previous one) implements this.

Paolo
--- orig/configure.ac
+++ mod/configure.ac
@@ -186,7 +186,7 @@ AC_DEFINE(_GNU_SOURCE, 1, [We want the d
 AC_HEADER_ASSERT
 AC_CHECK_HEADERS_ONCE(stdint.h inttypes.h unistd.h poll.h sys/ioctl.h \
        sys/resource.h sys/utsname.h stropts.h sys/param.h stddef.h limits.h \
-       sys/timeb.h termios.h sys/mman.h sys/file.h execinfo.h \
+       sys/timeb.h termios.h sys/mman.h sys/file.h execinfo.h utime.h \
        sys/wait.h fcntl.h, [], [], [AC_INCLUDES_DEFAULT])
 
 AC_TYPE_INT8_T
@@ -215,7 +215,7 @@ AC_REPLACE_FUNCS(putenv strdup strerror 
        getdtablesize strstr ftruncate floorl ceill sqrtl frexpl ldexpl asinl \
        acosl atanl logl expl tanl sinl cosl truncl lrintl strsep strpbrk)
 AC_CHECK_FUNCS_ONCE(gethostname memcpy memmove sighold uname sbrk usleep lstat 
\
-       grantpt popen getrusage gettimeofday getcwd fork strchr utimes \
+       grantpt popen getrusage gettimeofday getcwd fork strchr utimes utime \
        sigsetmask alarm select mprotect madvise nl_langinfo waitpid \
        setsid spawnl nanosleep pread pwrite)
 


--- orig/libgst/sysdep.c
+++ mod/libgst/sysdep.c
@@ -58,6 +58,10 @@
 
 #include "gstpriv.h"
 
+#ifdef HAVE_UTIME_H
+# include <utime.h>
+#endif
+
 #ifdef HAVE_SYS_TIMES_H
 # include <sys/times.h>
 #endif
@@ -745,11 +749,22 @@ _gst_get_cur_dir_name (void)
 _gst_set_file_access_times (const char *name, long new_atime, long new_mtime)
 {
   int result;
+#if defined HAVE_UTIMES
   struct timeval times[2];
   times[0].tv_sec = new_atime + 86400 * 10957;
   times[1].tv_sec = new_mtime + 86400 * 10957;
   times[0].tv_usec = times[1].tv_usec = 0;
   result = utimes (name, times);
+#elif defined HAVE_UTIME
+  struct utimbuf utb;
+  utb.actime = new_atime + 86400 * 10957;
+  utb.modtime = new_mtime + 86400 * 10957;
+  result = utime (name, &utb);
+#else
+#warning neither utime nor utimes are available.
+  errno = ENOSYS;
+  result = -1;
+#endif
   if (!result)
     errno = 0;
   return (result);

--- orig/tests/fileext.st
+++ mod/tests/fileext.st
@@ -72,4 +72,5 @@ testStripExtensionFrom
        [(File stripExtensionFrom: each key),
         (File extensionFor: each key) = each key] value printNl ]! !
 
+CSymbols.PathSeparator := $/.
 Object new testExtensionFor; testStripExtensionFrom!


--- orig/tests/local.at
+++ mod/tests/local.at
@@ -25,7 +25,7 @@ m4_define([AT_CHECK_GST], [
     *) GST="$AUTOTEST_PATH/gst m4_ifval([$2], [-I $2])" ;;
   esac
 
-  AT_CHECK([cd m4_ifval([$3], [$3], [$abs_top_builddir]) && $GST $1], 0, [$4], 
[$5])
+  AT_CHECK([cd m4_ifval([$3], [$3], [$abs_top_builddir]) && $GST $1 | tr -d 
'\r'], 0, [$4], [$5])
 ])
 
 dnl AT_DIFF_TEST([FILE], [XFAILS])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]