From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andreas Pretzsch <apr@cn-eng.de>
Cc: barebox@lists.infradead.org
Subject: Re: barebox-state (dt-utils): dump-shell broken for state@0
Date: Tue, 5 Apr 2016 08:49:30 +0200 [thread overview]
Message-ID: <20160405064930.GE9102@pengutronix.de> (raw)
In-Reply-To: <1459806291.24482.38.camel@ws-apr.office.loc>
+Cc mkl who wrote 6d58ca4
On Mon, Apr 04, 2016 at 11:44:51PM +0200, Andreas Pretzsch wrote:
> On Mi, 2015-06-17 at 11:06 +0200, Sascha Hauer wrote:
> > On Wed, Jun 17, 2015 at 08:42:50AM +0200, Jan Remmet wrote:
> > > Hello,
> > > I'm working with barebox states and wonder if there is already a tool to access
> > > states in eeprom from linux?
> > > The states from a dtb backend should be easy to read. For raw there must be
> > > looked under /proc/devicetree or a state kernel driver.
> >
> > Yes, there is such a tool here:
> >
> > git://git.pengutronix.de/git/tools/dt-utils.git
> >
> > The binary you'll need is barebox-state.
>
> barebox-state provides a command "--dump-shell" to dump the state
> suitable for shell sourcing.
> Essentially, it prints out variable=value pairs.
> So typical use would be a
> eval `barebox-state --dump-shell`
> somewhere in a shell script (incl. simple ones like busybox ash).
>
> Unfortunately, this breaks with indices in the state name, as @ is not
> escaped.
> Tested with dt-utils v2015.10.0, but according to code this is the case
> from v2015.05.0 up until master.
>
> As of commit 6d58ca4 "barebox-state: fix export of shell variables:",
> the fixed prefix "STATE_" was replaced by the supplied state name.
> Also in there, all '.' are replaced by '_' in the variable name. Not in
> the state name itself.
>
> The same would be necessary for (at least) '@', because it is invalid
> also inside a shell variable name. As probably other chars, just I'm not
> sure which might show up from the dts. So no premature patch from my
> side.
> Not only for the variable name, but also the state name itself.
>
> For clarification of the setup and behaviour, see below.
>
>
> Now, question would be how to fix this.
> Also replacing '@' by '_' might break existing users (e.g. when parsing
> from stdin or similar, instead of using shells eval command).
> On the other hand, status quo breaks the "described" use of dump
> _shell_ ...
>
> Talking about this, it might be also some idea to resurrect the old
> behaviour of always printing 'STATE_' as prefix instead of the state
> name from dts. Not sure if it's the best idea, or how to call such an
> extra option, didn't think it through by now.
> Just saying, as I will go this way here (as a hotfix) for my setup...
>
> Ideas, opinions ?
I'm in favor for resurrecting the old 'STATE_' behaviour, but I don't
know why Marc changed it. Maybe he has some more input.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-04-05 6:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-17 6:42 state: access from linux Jan Remmet
2015-06-17 9:06 ` Sascha Hauer
2015-06-17 13:52 ` Marc Kleine-Budde
2015-06-18 6:40 ` Jan Remmet
2016-04-04 21:44 ` barebox-state (dt-utils): dump-shell broken for state@0 Andreas Pretzsch
2016-04-05 6:49 ` Sascha Hauer [this message]
2016-04-06 9:38 ` Marc Kleine-Budde
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=20160405064930.GE9102@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=apr@cn-eng.de \
--cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox