From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1448 invoked from network); 12 Apr 2023 22:30:07 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 12 Apr 2023 22:30:07 -0000 Received: (qmail 16173 invoked by uid 550); 12 Apr 2023 22:30:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 16138 invoked from network); 12 Apr 2023 22:30:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681338589; x=1683930589; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=2zFS2fSZlmDXMGv+J6GpSFZL1Um9TFq0vYMld2SVBjE=; b=SPDriPKdO5qRZURIzOfkhAGazNRKJGSBCkMQj7ozpG5gp3YvddF/tfuw9VX0WRx1t2 PvHS4Yel5WQhuzoihGmVSwLKH9NSLDvD30LlizLW2wcKV/KQYvnI1+5YGTi74kGi7FNs 5RwdiU+RAcmgGUoC/Rl9dfKpBrS4F1FQrSl+yO4Rff/gUJYl1M5SmDppCHfaq+FSMN2i ntJVBFroXnnG36ooTSEh7smWP5GwseS+NEgnG7qR7lCrWyfHVrlpj7YsHO7Z6xHD1zaX 8BTDphbAc7T7CiSYLH39da5iv26yNQFoko2UtWp/tGPzkS4puqGz+7v6rmoNKsIceih6 LsyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681338589; x=1683930589; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2zFS2fSZlmDXMGv+J6GpSFZL1Um9TFq0vYMld2SVBjE=; b=EE+tDSeJ1Me5FKrd7ESRtgJO4TsK/RUTVcFjr64TnPYzBhPDQn/NAg7Zrvx1OiR8fU UeV9dnGp5HVyBpD4ppFPuR8zPy00cVswmkuY5qkzoAzUAZoH8XJLnZWjOanMTmDED+y4 a1gPji9Ty1Mm9eXru8hP686ocp2oBZk2e7xm5DybckPPsEwTTL2R5XZnuWFxp3CRhwKe KTaQVhnjTUpF6/10JPHrWYDZ+Qjq4XTzjUh/wIUySeuBuX86VUDc/uwMMRhWmOu19mwI PqErW1g/bQa1/EyKg4AIAqZL4icr0J0khZqX+ZKmX71pXJ/5GDkT3tuWEkVPBs39WIHf tcHg== X-Gm-Message-State: AAQBX9c3V/dsLRkSdEDQOwwwWNtJ5kCjR6J2O202Dn06vDg5HmbzoriO vVqfA+0kdg6S1elwgwP9tCGNw10IsTjyzZVC X-Google-Smtp-Source: AKy350boPgr3AMhSE2v4Biz9qWONxLq8t3JlDUZ4WPDWDlzTwSEv/PpGRWgmZSVgQXB3u/eWNQeazQ== X-Received: by 2002:a05:600c:2052:b0:3f0:7e02:a159 with SMTP id p18-20020a05600c205200b003f07e02a159mr175918wmg.15.1681338589417; Wed, 12 Apr 2023 15:29:49 -0700 (PDT) Message-ID: <2dea9525-6a71-846b-87a6-9c743a76d3b2@gmail.com> Date: Thu, 13 Apr 2023 00:29:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Content-Language: en-US To: musl@lists.openwall.com, Detlef Riekenberg References: From: Gabriel Ravier In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [musl] printf does not print anything (musl 1.2.3) On 4/12/23 23:35, Detlef Riekenberg wrote: > The attached test fails with musl 1.2.3 (does not print anything): > > > os: xubuntu 23.04 > compiled with: musl-gcc -O0 -std=c99 -Wall prog.c -o prog_musl-O0 > gcc: 12.2.0-17ubuntu1 > > > The programm is a tic-tac-toe game, but the source is stange: > * Filesize Original: 2745 byte (includes only ) > * Filesize after preprocess: with musl ~559k / with gnu libc ~571k > * After preprocess, the format string is ~100kb > * main() uses only one printf, and one arg has a scanf: > > ` > int main() { > while(*d) printf(fmt, arg); > } > ` > > For testing, i removed the "while(*d)", > but the binary using musl still does not print anything. > > > Compiling the original source with the same gcc and using gnu libc works > and the gnu libc version with the removed "while (*d)" produces an output of 23592 byte. > > > ioccc page: https://www.ioccc.org/2020/carlini/index.html > Also available on github: https://github.com/carlini/printf-tac-toe > > > I tried to subscribe to the list, but i have no confirmation yet, so please cc me. > > > -- > Bye bye ... Detlef The printf call in the linked program attempts to use printf with numbered argument conversion specifications with a position larger than 9 (such as 42). This is not portable to all POSIX systems, as POSIX specifies that the implementation need only support numbered argument conversion specifications with a position that is at most as large as the NL_ARGMAX macro (defined in limits.h), and POSIX's minimum requirement on the value of NL_ARGMAX is only of 9. Thusly, musl defines NL_ARGMAX to 9 and errors on numbered argument conversion specifications with a position larger than it.