From: Zdenek Kabelac <zkabelac@redhat.com>
To: buildroot@uclibc.org,
LVM general discussion and development <linux-lvm@redhat.com>,
LVM2 development <lvm-devel@redhat.com>
Subject: Re: [linux-lvm] [lvm-devel] MUSL fun
Date: Sat, 13 Feb 2016 22:02:55 +0100 [thread overview]
Message-ID: <56BF99FF.1030900@redhat.com> (raw)
In-Reply-To: <CA+BsyQ6ihax71VER=dgCHF-eV0mfjYqZo6LixK21BVrMCGb-Bg@mail.gmail.com>
Dne 13.2.2016 v 20:22 Brendan Heading napsal(a):
> Bernd,
>
> [cc buildroot]
>
> Like you I'd been investigating this issue from the buildroot end.
> Since October I've had no spare time to look at buildroot fixes.
>
> I was hoping for an explanation about why LVM implemented the above
> behaviour, but I never got one, and I didn't fancy working on a patch
> that would never get accepted when other projects were more open ..
>
> I think the best approach is probably just to add the freopen() patch
> as Romain suggested and keep the patch available in buildroot in the
> hope that we can build support for LVM to accept it.
>
> Brendan
>
>
> On 13 February 2016 at 18:48, Bernd Kuhls <bernd.kuhls-zqRNUXuvxA0b1SvskN2V4Q@public.gmane.org> wrote:
>> Am Tue, 15 Sep 2015 17:43:58 +0100 schrieb Brendan Heading:
>>
>>> In theory a straightforward fix would be to do something like:
>>>
>>> if (!freopen(NULL, "r", stdin))
>>> goto out;
>>>
>>> .. but I suspect there is a good reason why this isn't done. Can anyone
>>> shed any light on this ? If not I will submit a patch.
>>
>> Hi Brendan,
>>
>> the buildroot project also supports musl, the build of lvm2 fails due to
>> the problem you described. Did you find a working solution for the
>> problem? A patch I submitted to the buildroot project, based on patches I
>> found at the Alpinelinux project, raised some questions I am unable to
>> answer: http://patchwork.ozlabs.org/patch/573519/
>>
>> Regards, Bernd
Let's start from the beginning -
--
commands/toolcontext.c: In function 'create_toolcontext':
commands/toolcontext.c:1796:10: error: assignment of read-only variable 'stdin'
stdin = new_stream;
--
So now - from where comes the idea of 'stdin' being read-only variable ?
Looking at some POSIX spec e.g.:
http://pubs.opengroup.org/onlinepubs/009695399/functions/stdin.html
there is no sign of having this read-only var.
So what kind of OS this actually is ?
There is a reason from lvm2 implementation here - freopen() is not giving
application full control over internal buffer allocation and we need to be
sure we lock-in memory for critical section - and some glibc versions are
allocating buffers here via 'mmap' call.
That said - there could be accepted a patch checking in configure for
'read-only' stdin - and using then #ifdef compilation that would
replace use of internal lvm2 reopen code with libc function.
But the currently posted patch may possibly cause some other regressions.
Regards
Zdenek
next parent reply other threads:[~2016-02-13 21:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CA+BsyQ4tDvVFXyo2Po9jiFKVobaJhMy7PoxWjczT8KFK9BrXWQ@mail.gmail.com>
[not found] ` <1ca4pcxqnk.ln2@ID-313208.user.individual.net>
[not found] ` <CA+BsyQ6ihax71VER=dgCHF-eV0mfjYqZo6LixK21BVrMCGb-Bg@mail.gmail.com>
2016-02-13 21:02 ` Zdenek Kabelac [this message]
2016-02-13 21:19 ` [linux-lvm] [lvm-devel] MUSL fun Brendan Heading
2016-02-13 21:31 ` Brendan Heading
2016-02-13 21:36 ` Zdenek Kabelac
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=56BF99FF.1030900@redhat.com \
--to=zkabelac@redhat.com \
--cc=buildroot@uclibc.org \
--cc=linux-lvm@redhat.com \
--cc=lvm-devel@redhat.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.
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).