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

How to identify "running on a Hurd system"?

Hello there,

to work around a few portability issues in a test suite of a Debian
package, I need to know which platform (Linux/Hurd/kFreeBSD) I'm
currently running on.

This is a shell script, however `dpkg-architecture -qDEB_HOST_ARCH_OS`
isn't quite an option: For obvious reasons I'd like to upstream the
change, and dpkg* isn't available everywhere. The portable approach was
probably examining `uname -s` but appearently on Hurd this returns just
"GNU"[1] - at least on the Hurd porter box exodor -, and that's a bit

Any suggestions for a sane approach?

As a last resort I might create a very short C program that prints
an identification string based on the constants as listed in
but this feels like a dirty workaround.


PS: Please Cc me in replies, I'm not subscribed to the hurd list.

[1] As far as I can tell, this string is provided by the kernel via the
    uname syscall. On Hurd, I'd change that to something like
    "GNU/Hurd" since on kFreeBSD this yields "GNU/kFreeBSD". Take this
    as a kernel feature request.

Attachment: signature.asc
Description: Digital signature

Reply to: