WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Problem with tce-updating wpa-supplicant?  (Read 5071 times)

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: Problem with tce-updating wpa-supplicant?
« Reply #15 on: December 30, 2009, 05:10:22 PM »
The point is that if the two are treated differently by grep and such, then one would be preferred over the other.  And if whitespace is not desired, that sounds like a dash is not the more friendly for base and other functions.

The fact that the two are treated differently is all the more reason to standardize.

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Problem with tce-updating wpa-supplicant?
« Reply #16 on: December 30, 2009, 05:56:56 PM »
Whilst I'm always aghast when coming accross a space in a file name, I strongly believe we should allow for both dash and underscore (with a slight preference for the former).

I can't imagine a situation were 'grep -w' will really be an issue, that could not be avoided by a more suitable regular expression. We should not restrict ourselves too much in our choice of extension names due to (possibly historic) border cases of pattern matching. If it would be a real issue something would be broken now since our extension names are currently using both of them.

I believe to posses a fairly good grasp of regular expressions and their subtle differences when used in conjunction with the likes of grep, sed, vi, perl, ... I've avoided the use of 'grep -w' since those regular expressions might not be easily re-used with another tool.

I also had a quick look accross /usr/sbin, /usr/bin, and /etc/init.d and found only these two uses of 'grep -w':
Quote
/usr/bin/tce-load:81:           if [ -e "$FROMWHERE"/copy2fs.flg ] || grep -qw $APPNAME "$FROMWHERE"/copy2fs.lst 2>/dev/null; then

/etc/init.d/rc.shutdown:32:      if grep -w "$APP" "$LIST" >/dev/null 2>&1; then sed -i '/'"$APP"'/d' "$LIST"; fi

I can't right now see a reason to use 'grep -w' in either case, but I'm sure that there must be a good reason. Nevertheless I'm confident that the same effect can be achieved by some other way. I consider finding properly matching regular expressions an enjoyable brain teaser (maybe like some other folks solve crossword puzzle) and like to humbly offer my skills to find an alternative.

As I minor improvement I'd like to suggest to enclose the pattern in line 81 of tce-load in double-quotes. It's just a habit of mine due to have been bitten on this one a few times when I was less experienced.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Problem with tce-updating wpa-supplicant?
« Reply #17 on: December 30, 2009, 06:29:06 PM »
It was not until recently that we even had regular expression support in the base.
Base programs cannot use extensions to support base infrastructure.
There is always many ways to perform a task. Everyone has their preference.
I rarely comment on the many scripts posted in the forums.
Not everyone who wishes to script process extensions should be required to use regular expressions.
10+ Years Contributing to Linux Open Source Projects.