Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions absl/base/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#endif

// ABSL_HAVE_TLS is defined to 1 when __thread should be supported.
// We assume __thread is supported on Linux when compiled with Clang or
// We assume __thread is supported on Linux or Hurd when compiled with Clang or
// compiled against libstdc++ with _GLIBCXX_HAVE_TLS defined.
#ifdef ABSL_HAVE_TLS
#error ABSL_HAVE_TLS cannot be directly set
#elif (defined(__linux__)) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
#elif (defined(__linux__) || defined(__GNU__)) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
#define ABSL_HAVE_TLS 1
#elif defined(__INTEL_LLVM_COMPILER)
#define ABSL_HAVE_TLS 1
Expand Down Expand Up @@ -364,6 +364,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// WebAssembly (Emscripten) __EMSCRIPTEN__
// Fuchsia __Fuchsia__
// WebAssembly (WASI) _WASI_EMULATED_MMAN (implies __wasi__)
// GNU/Hurd __GNU__
//
// Note that since Android defines both __ANDROID__ and __linux__, one
// may probe for either Linux or Android by simply testing for __linux__.
Expand All @@ -379,7 +380,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || defined(__sun) || \
defined(__myriad2__) || defined(__HAIKU__) || defined(__OpenBSD__) || \
defined(__NetBSD__) || defined(__QNX__) || defined(__VXWORKS__) || \
defined(__hexagon__) || defined(__XTENSA__) || \
defined(__hexagon__) || defined(__XTENSA__) || defined(__GNU__) || \
defined(_WASI_EMULATED_MMAN)
#define ABSL_HAVE_MMAP 1
#endif
Expand Down Expand Up @@ -427,7 +428,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// platforms.
#ifdef ABSL_HAVE_SEMAPHORE_H
#error ABSL_HAVE_SEMAPHORE_H cannot be directly set
#elif defined(__linux__) || defined(__ros__) || defined(__VXWORKS__)
#elif defined(__linux__) || defined(__ros__) || defined(__VXWORKS__) || defined(__GNU__)
#define ABSL_HAVE_SEMAPHORE_H 1
#endif

Expand Down
2 changes: 1 addition & 1 deletion absl/base/internal/raw_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
// this, consider moving both to config.h instead.
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__hexagon__) || defined(__Fuchsia__) || defined(__OpenBSD__) || \
defined(__EMSCRIPTEN__) || defined(__ASYLO__)
defined(__EMSCRIPTEN__) || defined(__ASYLO__) || defined(__GNU__)

#include <unistd.h>

Expand Down
3 changes: 2 additions & 1 deletion absl/base/internal/strerror_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ TEST(StrErrorTest, InvalidErrorCode) {
errno = ERANGE;
EXPECT_THAT(absl::base_internal::StrError(-1),
AnyOf(Eq("No error information"), Eq("Unknown error -1"),
Eq("Unknown error")));
Eq("Unknown error"),
Eq("Error in unknown error system: FFFFFFFF")));
EXPECT_THAT(errno, Eq(ERANGE));
}

Expand Down
2 changes: 1 addition & 1 deletion absl/debugging/internal/symbolize.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE
#error ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE cannot be directly set
#elif defined(__ELF__) && defined(__GLIBC__) && !defined(__asmjs__) \
&& !defined(__wasm__)
&& !defined(__wasm__) && !defined(__GNU__)
Comment thread
mkruskal-google marked this conversation as resolved.
#define ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE 1

#include <elf.h>
Expand Down
5 changes: 3 additions & 2 deletions absl/log/log_modifier_methods_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,14 @@ TEST(TailCallsModifiesTest, WithPerror) {
Send(AllOf(
TextMessage(AnyOf(Eq("hello world: Bad file number [9]"),
Eq("hello world: Bad file descriptor [9]"),
Eq("hello world: Bad file descriptor [8]"))),
Eq("hello world: Bad file descriptor [8]"),
Eq("hello world: Bad file descriptor [1073741833]"))),
ENCODED_MESSAGE(HasValues(ElementsAre(
ValueWithLiteral(Eq("hello world")), ValueWithLiteral(Eq(": ")),
AnyOf(ValueWithStr(Eq("Bad file number")),
ValueWithStr(Eq("Bad file descriptor"))),
ValueWithLiteral(Eq(" [")),
AnyOf(ValueWithStr(Eq("8")), ValueWithStr(Eq("9"))),
AnyOf(ValueWithStr(Eq("8")), ValueWithStr(Eq("9")), ValueWithStr(Eq("1073741833"))),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little magical, where does this number come from?? Do we need tests to pass on Hurd? We don't run these in CI anyway and they're likely to backslide, so I'd be tempted to say we should revert all these test changes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little magical, where does this number come from??

It's simply the decimal value of EBADF, as I wrote in the commit/PR message:

tweak a log test for the different value of EBADF

In the Hurd implementation of GNU libc, the POSIX errnos start at 0x40000001 (the first). This is because there are different ranges of error values, and the POSIX values are one of those ranges (in addition to e.g. the Mach errors, IPC errors, etc).

$ grep -r EBADF /usr/include/i386-gnu/
/usr/include/i386-gnu/bits/errno.h:  EBADF                          = 0x40000009,       /* Bad file descriptor */
/usr/include/i386-gnu/bits/errno.h:#define EBADF                          0x40000009

$ errno EBADF
EBADF 1073741833 Bad file descriptor

See also the GNU libc Hurd sources: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mach/hurd/bits/errno.h;h=3b54f5855e21091123ab0669402550968f0746cf;hb=d70dd7d72273ac1aa53b435156de3f50f0c5a868#l37

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea my larger point is: is there any significant value to submitting fixes to get tests working on Hurd? I get that it was useful to produce this PR, but you only need the prod code to work right?

The test changes seem particularly confusing without context, and like they (marginally) weaken the tests in the platforms we do support.

The non-test changes all look fine to me

ValueWithLiteral(Eq("]"))))))));

test_sink.StartCapturingLogs();
Expand Down
2 changes: 1 addition & 1 deletion absl/log/stripping_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class StrippingTest : public ::testing::Test {
// Opens this program's executable file. Returns `nullptr` and writes to
// `stderr` on failure.
std::unique_ptr<FILE, std::function<void(FILE*)>> OpenTestExecutable() {
#if defined(__linux__)
#if defined(__linux__) || defined(__GNU__)
std::unique_ptr<FILE, std::function<void(FILE*)>> fp(
fopen("/proc/self/exe", "rb"), [](FILE* fp) { fclose(fp); });
if (!fp) {
Expand Down