X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id CC655DC0189 for ; Thu, 10 Apr 2014 06:15:17 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id s7so1975255lbd.1 for ; Wed, 09 Apr 2014 23:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=bxrbVPWAEAItjmHwQo34YVin+BJ8eCvvZWnXgufwr2s=; b=Sam1aJnMkYhU3cX90GHUIRLMl7AzuOV0EGgJU3iw44tMmkjbXC5d8ecEu4RIR3ip0S JZqlPiE/owAKYDaCESktMCT9ZFBn38e+YYw25iUbX23VjlOtLKzRBRkzE6IWXXzV80rh 2GvFGrsk4F3Q/XZbPVSCgFCjyfFgN6XwAo6woT669CL7FF1wR3qyag3bMnZbDBVrXeIx fofgj++76sHxbE0I+gKQTrnQvqJSfIwWBMiv3iiKR4GUp+4Dl1bRuWl5+jNhNqTTFUws p4tdnZrI9y8txjiuVE3KoMtKlUHnBOzt67h8i09+pMidHBt5zzqNW0AMqA/dBao6YNNd G7zQ== X-Received: by 10.112.85.6 with SMTP id d6mr10254748lbz.8.1397110190384; Wed, 09 Apr 2014 23:09:50 -0700 (PDT) Received: from vostro ([2001:1bc8:101:f402:21c:23ff:fefc:bf0b]) by mx.google.com with ESMTPSA id sx1sm3155036lac.1.2014.04.09.23.09.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Apr 2014 23:09:48 -0700 (PDT) Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= Date: Thu, 10 Apr 2014 09:11:16 +0300 From: Timo Teras To: Jeff Pohlmeyer Cc: Alpine Subject: Re: [alpine-devel] Segfault in hwclock Message-ID: <20140410091116.27ef34f0@vostro> In-Reply-To: References: X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; i486-alpine-linux-uclibc) X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 9 Apr 2014 17:16:14 -0500 Jeff Pohlmeyer wrote: > The "hwclock" program from util-linux is crashing with musl. Committed a fix. > The problem is on line 393 of util-linux-2.23.2/sys-utils/hwclock.c: > > setenv("TZ", getenv("TZUTC"), TRUE); > > Apparently musl's version of setenv() doesn't like it when the second > argument is NULL. Correct. This is per posix specification. value needs to point to a valid string. This is application code bug. > Compiling with gcc -Wall on ArchLinux/GNU-libc, I get a warning: > > warning: null argument where non-null required (argument 2) > [-Wnonnull] This is implies that glibc thinks same way. value must not be null. The attribute also allows compiler to assume this and optimize code accordingly. It would be perfectly valid for gcc to optimize glibc build in such a way that it would crash too. > But the program doesn't crash at run time. Depends on compiler. > With Alpine/musl, there is no compile time warning, but the program > crashes. > > So it looks like musl's setenv() could stand to be a bit more robust, > but hwclock > really shouldn't be passing it a null, either. Fixed application. Thanks for the report. - Timo --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---