Re: [Dorset] Very slow Desktop startup problem

2019-07-06 Thread Keith Edmunds
On Sat, 06 Jul 2019 07:54:08 +0100, ra...@inputplus.co.uk said:

> Having an unnoticed option can be the cause of awkward bugs

Try this:

$ ls
[directory listing]
$ ls *
[same directory listing]
$ touch -- -l # make a file called '-l'
$ ls *
[long directory listing as file '-l' is interpreted as an option

Now, imagine a file called ' -rf' and how that might impact an 'rm'
command.
-- 
Linux Tips: https://www.tiger-computing.co.uk/category/techtips/

-- 
  Next meeting: BEC, Bournemouth, Tuesday, 2019-08-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk/
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Discovering unfamiliar utilities

2019-07-06 Thread Patrick Wigmore
On Sat, 06 Jul 2019 09:33:15 +0100, Ralph Corderoy wrote:
> Well, I was wondering how it could be done and like solving the
> puzzle; keeps my hand in.

A good habit, for sure.

> The university used to have staff and students interested in Unix
> and ran Solaris or a descendant so there could be quite a few good
> books from those times.

I remember (or misremember) seeing a publicity shot of a Solaris lab 
at the university, probably about ten years ago. The lab was bathed in 
golden yellow light, which seems appropriate if the photo was taken in 
its sunset years. (And also because it was Sun.)

I think they had labs of PCs dual-booting Linux and Windows when I 
attended an open day a few years ago, and a room with all the walls 
decorated with shell scripts, penguins and the like.

Thank you for yet more book recommendations.

Patrick

-- 
  Next meeting: BEC, Bournemouth, Tuesday, 2019-08-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk/
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Discovering unfamiliar utilities

2019-07-06 Thread Ralph Corderoy
Hi Patrick,

> > For a one-off quick task, automating it would be more tedious.
>
> But you did it anyway, even though you didn't need the results!

Well, I was wondering how it could be done and like solving the puzzle;
keeps my hand in.  What I did was O(n²) though, where n is the number of
files.  For production, fgrep's patterns should be calculated just once.

> There seems to be a copy of it in the library at Bournemouth
> University.  https://capitadiscovery.co.uk/bournemouth-ac/items/91529
> At some point I will head over there to have a read and see what's
> nearby on the shelves

The university used to have staff and students interested in Unix and
ran Solaris or a descendant so there could be quite a few good books
from those times.  Skimming
https://capitadiscovery.co.uk/bournemouth-ac/items?query=subject%3A%28UNIX%29=publishedyear
I see decent ones they have include

Stevens' Unix network programming.
Levine's Lex & yacc.
McKusick's Design and implementation of the 4.4BSD operating system.

A book well worth reading they've got is Jon Bentley's ‘Programming
Pearls’.  He was at Bell Labs and uses the Unix shell and small C
programs to tackle many interesting problems.


https://capitadiscovery.co.uk/bournemouth-ac/items?query=subject%3A%28UNIX%29=publishedyear

They also have Aho, Hopcroft, and Ullman's ‘Data structures and
algorithms’ if you like that kind of thing.  Bell Labs again, they
invented some of them and ‘wrote the book’.

I found the search's ability to list the oldest books first useful;
if they have an old book then it's probably one of the classics.

-- 
Cheers, Ralph.

-- 
  Next meeting: BEC, Bournemouth, Tuesday, 2019-08-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk/
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Very slow Desktop startup problem

2019-07-06 Thread Ralph Corderoy
Hi Victor,

> > > Saying 'do_something_interesting 2>&1 > something_interesting.log'
> >
> > Or, the alternative action of ‘foo >bar 2>&1’.  :-)
>
> Now to me, it's more logical to tinker with the file descriptors of
> the command first and then say where they are going rather than vice
> versa.

But the order is significant.  :-)

$ >foo
$
$ ls foo missing >out 2>&1
$ cat out
ls: cannot access 'missing': No such file or directory
foo
$
$ rm out
$ ls foo missing 2>&1 >out
ls: cannot access 'missing': No such file or directory
$ cat out
foo
$

> On a related note I recall early *nixes where the command switches had
> to precede all the other arguments.

That's also the POSIX standard today; see getopt(3p).

> Took me years to get used to the fact that in later versions you could
> say 'ls foo* -l'

This is a GNU extension and a bad idea.  The Unix way is ‘ls -l -t foo
bar xyzzy’ that matches ‘verb adverbs nouns’.  It means the reader can
stop on reaching the first non-option argument, knowing the rest are
data rather than options.  And code can do that same, e.g.  getopt().
Having an unnoticed option can be the cause of awkward bugs, even
dangerous ones depending on the command, and can come about through
command-line editing.  If that option is treating as an argument, a
filename say, then that tends to have a lot less impact.

-- 
Cheers, Ralph.

-- 
  Next meeting: BEC, Bournemouth, Tuesday, 2019-08-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk/
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk