Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15017
| Path | csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | mike b <michallinuxstuff@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: Reading from a file by using its FD returns its contents only once |
| Date | Mon, 31 Dec 2018 18:19:06 +0100 |
| Lines | 46 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.6627.1546276767.1284.bug-bash@gnu.org> (permalink) |
| References | <CACosJgxBTuPp9KpUuT5nST9dB7uFqP2gJ31q76C8O9owRU7_iw@mail.gmail.com> <CAN-HRFYUThxx6XwT59XHZoevdYOJRT3e6wLfS8A+yd+2w5hmvg@mail.gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | usenet.stanford.edu 1546276767 1549 208.118.235.17 (31 Dec 2018 17:19:27 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | Tadeus Prastowo <tadeus.prastowo@unitn.it>, bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=+6EGGJ3wP4sPAEUYtJ/dhA1vQFvfNK8fT2C/9ibFZio=; b=LmeEUJ/EQZFpVsRZGCoilk/qLmS4H6kEc+LKYNxFw6CLPtkDQHsxLMOWBq15SMaVQS RfH/ulWDtDLSHGuBU9DSrpV7Xc+Jb/k7pdpxgbuKgId7ut51IIqdIm1qYv4+shuUg+9E 4Y7h/URIJPiCBm57pbbU4+VCQjDNwOVYmqGsq0BxpWyGgZJAAqgd/GR8BsgpmQXvVTgq j8O/VcmM4fwSY5pNueDYwza9+KzS4RXpWjkng/Wpdyn6RS41/Rdk7H7+OPWyfYCCxpBb zh+FJU/RYx2+9kUqqq4c1FhZ2QQvTzP1t0TS+1VomN1rNjtBE8if14ps9vD2mIWK/Hhh 7DgA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=+6EGGJ3wP4sPAEUYtJ/dhA1vQFvfNK8fT2C/9ibFZio=; b=bzV+/EMzSgGA3bRxv/fwyhPIuujJuWOU7d0ZASBR1cWtDLdSvz2Udbv55osF7GYnyo 07/xoe9Deljsj5n4VdsBEhi1M97yPOg85YClXJexFS0zu4wjtL8DrDTCY9SooEqlttA2 wjzuwRxsrykViF9+blG6HlkbPJSGBqOiXPjlMZP3hyJoV3aMP/+EjSv8/N2gxgoxpjIJ kPKgGLyl64e4Zr/qNAz8knLDgLWaaxIRMcKFVXEjJYzcyt9BhcEVE3SridnrqnUHFHdf aB3/oXwzsQwXHiMoCp28Qwh1juntyK4i/bSBAg8iLowcC+fdyrW2hU5wVezu62UZpJuz Y4kA== |
| X-Gm-Message-State | AA+aEWboNlxThpnA1C8PBc90BHlSFZ6aIWCDGfuOo0JVTfaWoIA1w7fE e3rQJ53EklOw6frBBhOBXvTJaJUOsOB7Wwpa4zCFVw== |
| X-Google-Smtp-Source | AFSGD/WxqM2h/+u4+MVXm+VUvaC0MIIAVo7tI/PG63jNzm0F7SvHFMRU4SQlkiktSktnMZY9gEwF5o/hYx+7EB+ova8= |
| X-Received | by 2002:a62:4c5:: with SMTP id 188mr39153275pfe.130.1546276758910; Mon, 31 Dec 2018 09:19:18 -0800 (PST) |
| In-Reply-To | <CAN-HRFYUThxx6XwT59XHZoevdYOJRT3e6wLfS8A+yd+2w5hmvg@mail.gmail.com> |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2607:f8b0:4864:20::429 |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:15017 |
Show key headers only | View raw
That's a good point, I haven't thought about it like this. I always thought
that each read always starts at the beginning of the file given fd points
at. So the fact that it changes offset is a bit surprising:
# echo word >t
# exec {in}<t
# read -rn1 -u"$in"; echo "$REPLY"
w
# read -rn1 -u"$in"; echo "$REPLY"
o
# read -rn1 -u"$in"; echo "$REPLY"
r
# read -rn1 -u"$in"; echo "$REPLY"
d
I mean, it's surprising to me, I am not saying it's bad behavior or
anything.
Anyways, thanks for your feedback Tadeus. :)
pon., 31 gru 2018 o 17:40 Tadeus Prastowo <tadeus.prastowo@unitn.it>
napisaĆ(a):
> On Mon, Dec 31, 2018 at 2:37 AM mike b <michallinuxstuff@gmail.com> wrote:
>
> [...]
>
> > The above is just an example. Doing reads on any other regular file like
> > this yields same behavior:
> > # echo bla >./t
> > # exec 10<./t
> > # read -r <&10
> > # echo $REPLY
> > bla
> > # read -r <&10
> > # echo $REPLY
>
> That's correct behavior because the second `read -r' already hits an
> EOF, isn't that?
>
> --
> Best regards,
> Tadeus
>
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Reading from a file by using its FD returns its contents only once mike b <michallinuxstuff@gmail.com> - 2018-12-31 18:19 +0100
csiph-web