mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Ariadne Conill <ariadne@dereferenced.org>
To: musl@lists.openwall.com, "Dmitry V. Levin" <ldv@altlinux.org>,
	Bruno Haible <bruno@clisp.org>
Cc: config-patches@gnu.org
Subject: Re: [musl] Re: OS detection wrong on Alpine Linux 3.10
Date: Sun, 20 Sep 2020 06:19:10 -0600	[thread overview]
Message-ID: <9987c415-e8b9-d2e4-5488-8049718b1326@dereferenced.org> (raw)
In-Reply-To: <20200920101249.GA29409@altlinux.org>

Hello,

On 2020-09-20 04:12, Dmitry V. Levin wrote:
> On Sat, Sep 19, 2020 at 03:30:54PM +0200, Bruno Haible wrote:
>> The value of $host_os, determined by the current config.guess, is:
>>    - On Alpine Linux 3.9: linux-musl
>>    - On Alpine Linux 3.10: linux-gnu
>>    - On Alpine Linux 3.12: linux-musl
>>
>> The reason is that config.guess tests 'ldd --version'. However, in
>> Alpine Linux 3.10, /usr/bin/ldd has been replaced with a shell script
>> that does not understand the --version option:
>>
>> $ cat /usr/bin/ldd
>> #!/bin/sh
>> exec /lib/ld-musl-x86_64.so.1 --list -- "$@"
>> $ /usr/bin/ldd --version 2>&1
>> /lib/ld-musl-x86_64.so.1: cannot load --version: No such file or directory
>>
>> Find attached a proposed fix. More details in
>> <https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00098.html>.
>>
>> Bruno
> 
>> >From 6e8da56c68ad94175d67acfc6257e614fe74e01d Mon Sep 17 00:00:00 2001
>> From: Bruno Haible <bruno@clisp.org>
>> Date: Sat, 19 Sep 2020 15:24:59 +0200
>> Subject: [PATCH] * config.guess: Fix determination of musl libc on Alpine
>>   Linux 3.10.
>>
>> ---
>>   ChangeLog    |  5 +++++
>>   config.guess | 14 ++++++--------
>>   2 files changed, 11 insertions(+), 8 deletions(-)
>>
>> diff --git a/ChangeLog b/ChangeLog
>> index 4f106db..834f4e5 100644
>> --- a/ChangeLog
>> +++ b/ChangeLog
>> @@ -1,3 +1,8 @@
>> +2020-09-19  Bruno Haible  <bruno@clisp.org>
>> +
>> +	* config.guess: Don't use 'ldd --version' to determine the presence of
>> +	musl libc, as this fails on Alpine Linux 3.10.
>> +
>>   2020-09-08  Elad Lahav  <e2lahav@gmail.com>
>>   	    Ben Elliston  <bje@gnu.org>
>>   
>> diff --git a/config.guess b/config.guess
>> index 9aff91c..8d70ec2 100755
>> --- a/config.guess
>> +++ b/config.guess
>> @@ -2,7 +2,7 @@
>>   # Attempt to guess a canonical system name.
>>   #   Copyright 1992-2020 Free Software Foundation, Inc.
>>   
>> -timestamp='2020-08-17'
>> +timestamp='2020-09-19'
>>   
>>   # This file is free software; you can redistribute it and/or modify it
>>   # under the terms of the GNU General Public License as published by
>> @@ -150,17 +150,15 @@ Linux|GNU|GNU/*)
>>   	#elif defined(__dietlibc__)
>>   	LIBC=dietlibc
>>   	#else
>> +	#include <stdarg.h>
>> +	#ifdef __DEFINED_va_list
>> +	LIBC=musl
>> +	#else
>>   	LIBC=gnu
>>   	#endif
>> +	#endif
>>   	EOF
>>   	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
>> -
>> -	# If ldd exists, use it to detect musl libc.
>> -	if command -v ldd >/dev/null && \
>> -		ldd --version 2>&1 | grep -q ^musl
>> -	then
>> -	    LIBC=musl
>> -	fi
>>   	;;
>>   esac
>>   
> 
> Is this __DEFINED_va_list macro the official way of detecting musl?
> It looks very fragile to me.

There is no official way of detecting musl.

Ariadne

      parent reply	other threads:[~2020-09-20 12:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4768019.hHWyC0TzgU@omega>
2020-09-20 10:12 ` Dmitry V. Levin
2020-09-20 11:19   ` Bruno Haible
2020-09-20 12:18     ` Ariadne Conill
2020-09-20 13:56     ` Szabolcs Nagy
2020-09-20 17:14       ` Rich Felker
2020-09-20 19:21         ` Bruno Haible
2020-09-20 20:58           ` Hadrien Lacour
2020-09-21  6:53           ` A. Wilcox
2020-09-21 11:46             ` Florian Weimer
2020-09-22 18:46           ` Rich Felker
2020-09-22 20:18             ` Bruno Haible
2020-09-22 20:33               ` Jeffrey Walton
2020-09-22 20:39             ` Jeffrey Walton
2020-09-22 21:04               ` Laurent Bercot
2020-09-22 21:17                 ` Jeffrey Walton
2020-09-23  8:49                   ` Laurent Bercot
2020-09-23 13:13                     ` James Y Knight
2020-09-23 16:08                       ` Rich Felker
2020-09-23 16:16                         ` Jeffrey Walton
2020-09-23 16:26                           ` Ariadne Conill
2020-09-23 16:57                             ` Jeffrey Walton
2020-09-23 16:36                           ` Rich Felker
2020-09-20 12:19   ` Ariadne Conill [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9987c415-e8b9-d2e4-5488-8049718b1326@dereferenced.org \
    --to=ariadne@dereferenced.org \
    --cc=bruno@clisp.org \
    --cc=config-patches@gnu.org \
    --cc=ldv@altlinux.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).