[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Fix various Haiku issues
From: |
Mario Domenech Goulart |
Subject: |
Re: [Chicken-hackers] [PATCH] Fix various Haiku issues |
Date: |
Sun, 10 Nov 2013 21:14:28 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Hi Peter,
On Sun, 10 Nov 2013 21:58:01 +0100 Peter Bex <address@hidden> wrote:
> I decided to give Haiku another try and many things broke.
> Attached is a patch that attempts to fix this (two things are
> taken straight from the Haiku CHICKEN port, which should've really
> been fixed in core).
I think it would be better to split this patch into a patch per change,
so we can properly bisect and easily revert changes if needed. "git add -p"
can be handy at splitting it.
I couldn't find the code related to the "The unsetenv() test failed. It
was using putenv() but Haiku is a (mostly) GNU system so unsetenv() is
available" note in the commit message.
Best wishes.
Mario
> I think these changes should go into stability.
>
> Cheers,
> Peter
> --
> http://www.more-magic.net
>
>>From 469cd10e9a11f146b1056ebb65b99dfc39d06a74 Mon Sep 17 00:00:00 2001
> From: Peter Bex <address@hidden>
> Date: Sun, 10 Nov 2013 21:53:32 +0100
> Subject: [PATCH] Fix various Haiku issues
>
> - It was unable to load shared libraries (module files) outside LIBRARY_PATH
> because it wasn't marked as an ELF platform
> - The unsetenv() test failed. It was using putenv() but Haiku is a (mostly)
> GNU system so unsetenv() is available
> - repository path support was broken as it used strcat() on uninitialized
> memory
> - fast_read_string_from_file defined variables after other statements; this
> is not accepted by GCC 2, which Haiku still uses as main compiler
> ---
> chicken.h | 4 ++--
> csc.scm | 2 +-
> eval.scm | 2 +-
> library.scm | 3 ++-
> 4 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/chicken.h b/chicken.h
> index 15e2ad6..6265940 100644
> --- a/chicken.h
> +++ b/chicken.h
> @@ -73,7 +73,7 @@
> # define C_XXXBSD
> #endif
>
> -#if /*defined(__GNUC__) &&*/ (defined(__linux__) || defined(C_XXXBSD))
> +#if /*defined(__GNUC__) &&*/ (defined(__linux__) || defined(C_XXXBSD) ||
> defined(__HAIKU__))
> # define C_GNU_ENV
> #endif
>
> @@ -3047,7 +3047,7 @@ C_path_to_executable(C_char *fname)
>
> while (get_next_image_info(0, &cookie, &info) == B_OK) {
> if (info.type == B_APP_IMAGE) {
> - C_strcat(buffer, info.name);
> + C_strcpy(buffer, info.name);
>
> for(i = C_strlen(buffer); i >= 0 && buffer[ i ] != '/'; --i);
>
> diff --git a/csc.scm b/csc.scm
> index bf76b60..0248e0a 100644
> --- a/csc.scm
> +++ b/csc.scm
> @@ -73,7 +73,7 @@
> (define aix (eq? (build-platform) 'aix))
>
> (define elf
> - (memq (software-version) '(linux netbsd freebsd solaris openbsd hurd)))
> + (memq (software-version) '(linux netbsd freebsd solaris openbsd hurd
> haiku)))
>
> (define (stop msg . args)
> (fprintf (current-error-port) "~a: ~?~%" CSC_PROGRAM msg args)
> diff --git a/eval.scm b/eval.scm
> index bf447d8..7940066 100644
> --- a/eval.scm
> +++ b/eval.scm
> @@ -1066,7 +1066,7 @@
>
> (define dynamic-load-libraries
> (let ((ext
> - (if (and (memq (software-version) '(linux netbsd openbsd freebsd))
> + (if (and (memq (software-version) '(linux netbsd openbsd freebsd
> haiku))
> (not (zero? binary-version))) ; allow "configless" build
> (string-append
> ##sys#load-library-extension
> diff --git a/library.scm b/library.scm
> index db9fe31..6756b32 100644
> --- a/library.scm
> +++ b/library.scm
> @@ -109,13 +109,14 @@ fast_read_line_from_file(C_word str, C_word port,
> C_word size) {
> static C_word
> fast_read_string_from_file(C_word dest, C_word port, C_word len, C_word pos)
> {
> + size_t m;
> int n = C_unfix (len);
> char * buf = ((char *)C_data_pointer (dest) + C_unfix (pos));
> C_FILEPTR fp = C_port_file (port);
>
> if(feof(fp)) return C_SCHEME_END_OF_FILE;
>
> - size_t m = fread (buf, sizeof (char), n, fp);
> + m = fread (buf, sizeof (char), n, fp);
>
> if (m < n) {
> if (ferror(fp)) /* Report to Scheme, which may retry, so clear errors */
--
http://parenteses.org/mario