All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaromir Capik <jcapik@redhat.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] Avoiding warnings when piping to sensors-detect
Date: Fri, 26 Jul 2013 10:01:30 +0000	[thread overview]
Message-ID: <496833531.7275762.1374832890632.JavaMail.root@redhat.com> (raw)
In-Reply-To: <699701256.6909990.1374770991358.JavaMail.root@redhat.com>

Hi Jean.

> Hi Jaromir,
> 
> On Thu, 25 Jul 2013 12:49:51 -0400 (EDT), Jaromir Capik wrote:
> > The attached patch fixes <STDIN> handling when the user
> > input is taken from /dev/null.
> > I know this way of generating the config is undocumented
> > and therefore unsupported, but it seems people use it
> > that way as the script doesn't support running in
> > batch mode.
> > 
> > The patch was created for 3.3.4, but can be directly
> > applied on the latest sources too.
> > 
> > Please, merge the fix.
> 
> Hmm, as far as I can see this solves the same problem as this patch of
> mine I posted some months ago:
> http://marc.info/?l=lm-sensors&m\x135091022118747&w=2
> 
> The only reason why I did not commit it yet is that I was waiting for
> feedback, but the original requester never provided it :(
> 
> If my patch works for you and your users then I'll just apply it.

I was unable to apply your patch directly, but
I believe it must work correctly.
Having a switch is always better than piping.
However, I know about users who already built their
solution with redirection and that's why I'd like to
propose one tiny modification of your patch in order
to make it more robust for cases like that.

Please, teplace the following line:

	return <STDIN>;

with this:

	return <STDIN> || '';


This would prevent the script from printing warnings about uninitialised
value. <STDIN> acts as uninitialised value when there are no more data
on the standard input. The modified expression returns empty string instead.

Regardless of the fact, that users should not use it that way,
it's more safe/correct.

Thanks in advance.

Regards,
Jaromir.

--
Jaromir Capik
Red Hat Czech, s.r.o.
Software Engineer / BaseOS

Email: jcapik@redhat.com
Web: www.cz.redhat.com
Red Hat Czech s.r.o., Purkynova 99/71, 612 45, Brno, Czech Republic
IC: 27690016 

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2013-07-26 10:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 16:49 [lm-sensors] [PATCH] Avoiding warnings when piping to sensors-detect Jaromir Capik
2013-07-25 18:45 ` Jean Delvare
2013-07-26 10:01 ` Jaromir Capik [this message]
2013-07-26 12:58 ` Jean Delvare
2013-07-26 14:31 ` Jaromir Capik
2013-07-28 12:17 ` Jean Delvare
2013-07-30 17:50 ` Jaromir Capik
2013-09-11 11:47 ` Jean Delvare

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=496833531.7275762.1374832890632.JavaMail.root@redhat.com \
    --to=jcapik@redhat.com \
    --cc=lm-sensors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.