Re: [PATCH v4 1/5] t9300: factor out portable "head -c" replacement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> In shell scripts it is sometimes useful to be able to read
> exactly N bytes from a pipe. Doing this portably turns out
> to be surprisingly difficult.

I'd rotate the above by three words ;-).

    It is sometimes useful to be able to read
    exactly N bytes from a pipe. Doing this portably turns out
    to be surprisingly difficult
    in shell scripts.

>   - "dd bs=1 count=$n" fixes the partial read problem (all
>     reads are 1-byte, so there can be no partial response).
>     It does make a lot of write() calls, but for our tests
>     that's unlikely to matter.

It makes me wonder if it helps to use different ibs and obs if many
writes bother you, but because this patch moves us away from dd,
that is a moot point.

> That makes the perl solution the least bad (because we
> conveniently omitted "length of code" as a criterion).
> It's also what t9300 is currently using, so we can just pull
> the implementation from there.

;-).

The patch itself is good.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]