# Gnu/Hurd support

- Thread: https://externals.io/message/69353
- Original archive: https://news-web.php.net/php.internals/69353
- Started by Lior Kaplan on 2013-09-26T14:22:57+00:00
- Messages: 9
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #69353 — Lior Kaplan — 2013-09-26T14:22:57+00:00

URL: https://externals.io/message/69353#69353

Hi,

In Debian we build PHP for GNU/Hurd system, which need some minor fixes
available here:

http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=blob;f=debian/patches/116-posixness_fix.patch

(per the guidelines here:
http://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL
)

There's another few bits here for the opcache extension in 5.5:
http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=blob;f=debian/patches/Zend_OpCache_GNUHurd_fix.patch;hb=HEAD

Kaplan

---

## #69354 — Christopher Jones — 2013-09-26T15:04:00+00:00

URL: https://externals.io/message/69353#69354 · In reply to: #69353

> Hi,
>
> In Debian we build PHP for GNU/Hurd system, which need some minor fixes
> available here:
>
> http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=blob;f=debian/patches/116-posixness_fix.patch
>
> (per the guidelines here:
> http://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL
> )
>
> There's another few bits here for the opcache extension in 5.5:
> http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=blob;f=debian/patches/Zend_OpCache_GNUHurd_fix.patch;hb=HEAD
>
> Kaplan
>

Can you create a PR on github for them?

Chris

-- 
christopher.jones@oracle.com  http://twitter.com/ghrd
Free PHP & Oracle book:
http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

---

## #69393 — Lior Kaplan — 2013-09-27T12:57:25+00:00

URL: https://externals.io/message/69353#69393 · In reply to: #69354

On Thu, Sep 26, 2013 at 5:04 PM, Christopher Jones <
christopher.jones@oracle.com> wrote:

>
> Can you create a PR on github for them?
>

Of course.

https://github.com/php/php-src/pull/476

Kaplan

---

## #69394 — Derick Rethans — 2013-09-27T13:02:05+00:00

URL: https://externals.io/message/69353#69394 · In reply to: #69353

> Hi,
> 
> In Debian we build PHP for GNU/Hurd system, which need some minor fixes
> available here:
> 
> http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=blob;f=debian/patches/116-posixness_fix.patch

  46 --- php5.orig/main/php.h
  47 +++ php5/main/php.h
  48 @@ -244,6 +244,10 @@ END_EXTERN_C()
  49  /* macros */
  50  #define STR_PRINT(str) ((str)?(str):"")
  51  
  52 +#ifndef PATH_MAX
  53 +#define PATH_MAX 4096
  54 +#endif
  55 +
  56  #ifndef MAXPATHLEN
  57  # ifdef PATH_MAX
  58  #  define MAXPATHLEN PATH_MAX

That looks wrong. You're unconditionally defining PATH_MAX, but there is 
logic in line 57 that deals with this too...

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine

---

## #69403 — Lior Kaplan — 2013-09-28T09:43:58+00:00

URL: https://externals.io/message/69353#69403 · In reply to: #69394

> 
>
> > […]
> http://anonscm.debian.org/gitweb/?p=pkg-php/php.git;a=blob;f=debian/patches/116-posixness_fix.patch
>
>   46 --- php5.orig/main/php.h
>   47 +++ php5/main/php.h
>   48 @@ -244,6 +244,10 @@ END_EXTERN_C()
>   49  /* macros */
>   50  #define STR_PRINT(str) ((str)?(str):"")
>   51
>   52 +#ifndef PATH_MAX
>   53 +#define PATH_MAX 4096
>   54 +#endif
>   55 +
>   56  #ifndef MAXPATHLEN
>   57  # ifdef PATH_MAX
>   58  #  define MAXPATHLEN PATH_MAX
>
> That looks wrong. You're unconditionally defining PATH_MAX, but there is
> logic in line 57 that deals with this too...
>

That whole section is about defining MAXPATHLEN, not PATH_MAX.

Kaplan

---

## #69406 — Derick Rethans — 2013-09-28T10:57:19+00:00

URL: https://externals.io/message/69353#69406 · In reply to: #69403

> 
> 
> > […]
> 
> That whole section is about defining MAXPATHLEN, not PATH_MAX.

Sure it is, but currently that code reads:

#ifndef MAXPATHLEN
# ifdef PATH_MAX
#  define MAXPATHLEN PATH_MAX
# elif defined(MAX_PATH)
#  define MAXPATHLEN MAX_PATH
# else
#  define MAXPATHLEN 256    /* Should be safe for any weird systems that do not …
# endif
#endif

With your change, PATH_MAX is *always* defined, so the fallback to 
defined(MAX_PATH) - which is probably valid on some other platform - is 
no longer used. These lines were added by Ilia:

cd82349b (Ilia Alshanetsky     2005-12-20 14:24:24 +0000 250) # elif defined(MAX_PATH)
cd82349b (Ilia Alshanetsky     2005-12-20 14:24:24 +0000 251) #  define MAXPATHLEN MAX_PATH

With as comment:

commit cd82349b9e51c6986ede11f482f727e12717a6f5
Author: Ilia Alshanetsky <iliaa@php.net>
Date:   Tue Dec 20 14:24:24 2005 +0000

    Fixed bug #31347 (is_dir and is_file (incorrectly) return true for any
    string greater then 255 characters).

And bug 31347 is that was a fix for a specific issue on Windows:
https://bugs.php.net/bug.php?id=31347

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine

---

## #69407 — Lior Kaplan — 2013-09-28T13:44:51+00:00

URL: https://externals.io/message/69353#69407 · In reply to: #69406

> And bug 31347 is that was a fix for a specific issue on Windows:
> https://bugs.php.net/bug.php?id=31347
>

The patch originates in Debian, and I can assure you that they don't build
for Windows (:
So that's a good point, thanks.

We could probably test for ZEND_WIN32, or at least that's what I see at
ext/opcache/ZendAccelerator.h which just got a similar patch for GNU/Hurd
support (commit f90483001236c863abe1070d05ee2214db5a0a97).

If that sounds OK, I'll try to do the change (although I'm not a developer).

Kaplan

---

## #69442 — Lior Kaplan — 2013-10-02T09:39:22+00:00

URL: https://externals.io/message/69353#69442 · In reply to: #69407

> 
>
> > […]
>
> The patch originates in Debian, and I can assure you that they don't build
> for Windows (:
> So that's a good point, thanks.
>
> We could probably test for ZEND_WIN32, or at least that's what I see at
> ext/opcache/ZendAccelerator.h which just got a similar patch for GNU/Hurd
> support (commit f90483001236c863abe1070d05ee2214db5a0a97).
>
> If that sounds OK, I'll try to do the change (although I'm not a
> developer).
>

Ping ?

I need this feedback to try and suggest a fixed patch.

(sorry, not a developer, just practicing general knowledge and what I see
in other commits).

Kaplan

---

## #69443 — Michael Wallner — 2013-10-02T09:55:40+00:00

URL: https://externals.io/message/69353#69443 · In reply to: #69442

> 
>
> > […]
>
> Ping ?
>
> I need this feedback to try and suggest a fixed patch.
>
> (sorry, not a developer, just practicing general knowledge and what I see
> in other commits).

Turn it around to something like:

$ git diff
diff --git a/main/php.h b/main/php.h
index 7c1f8fd..951a4d9 100644
--- a/main/php.h
+++ b/main/php.h
@@ -254,6 +254,10 @@ END_EXTERN_C()
 # endif
 #endif

+#ifndef PATH_MAX
+# define PATH_MAX MAXPATHLEN
+#endif
+
 #if defined(__GNUC__) && __GNUC__ >= 4
 # define php_ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; }))
 #else



-- 
Regards,
Mike
