]> git.deb.at Git - pkg/beep.git/blob - README
Explicitly call set -e
[pkg/beep.git] / README
1 Intro
2 -----
3
4 I just got so tired of being limited to printf("\a"); when I wanted a terminal
5 beep.  This program isn't supposed to be anything stupendous, it's just
6 supposed to get the job done.  Its intended purpose in life is to live inside
7 shell/perl scripts, and allow a little more granularity than you get with the
8 default terminal bell.  Maybe I'm the only one who thinks this is useful. :)
9
10 If for any reason you decide you need to, contact me:
11
12 johnath@johnath.com
13 http://johnath.com/
14
15 And beep can generally be found at:
16
17 http://johnath.com/beep/
18
19 For installation instructions, see INSTALL.
20 For copying and (non-)warranty information, see COPYING.
21 For usage information, check the man page.
22
23 fryguy (Ryan Weaver) at freshmeat.net has packaged beep in RPM format and has 
24 promised to try to get new rpms out with each new source release.  RPMs can be
25 found, among other places, at:
26
27 ftp://ftp.falsehope.com/pub/beep/
28
29 or
30
31 ftp://ftp.freshmeat.net/pub/rpms/beep/
32
33
34 A note about ioctl
35 ------------------
36
37 As noted in the man page, some users are running into a situation where beep 
38 dies with a complaint from ioctl().  The reason for this, as Peter Tirsek was
39 nice enough to point out to me, stems from how the kernel handles beep's 
40 attempt to poke at (for non-programmers: ioctl is a sort of catch-all function
41 that lets you poke at things that have no other predefined poking-at mechanism)
42 the tty, which is how it beeps.  The short story is, the kernel checks that 
43 either:
44
45 - you are the superuser
46 - you own the current tty
47
48 What this means is that root can always make beep work (to the best of my 
49 knowledge!), and that any local user can make beep work, BUT a non-root remote
50 user cannot use beep in it's natural state.  What's worse, an xterm, or other
51 x-session counts, as far as the kernel is concerned, as 'remote', so beep 
52 won't work from a non-priviledged xterm either.  I had originally chalked this
53 up to a bug, but there's actually nothing I can do about it, and it really is 
54 a Good Thing that the kernel does things this way.  There is also a solution.
55
56 By default beep is not installed with the suid bit set, because that would 
57 just be zany.  On the other hand, if you do make it suid root, all your 
58 problems with beep bailing on ioctl calls will magically vanish, which is 
59 pleasant, and the only reason not to is that any suid program is a potential 
60 security hole.  Conveniently, beep is very short, so auditing it is pretty 
61 straightforward.
62
63 Decide for yourself, of course, but it looks safe to me - there's only one 
64 buffer and fgets doesn't let it overflow, there's only one file opening, and 
65 while there is a potential race condition there, it's with /dev/console.  If 
66 someone can exploit this race by replacing /dev/console, you've got bigger 
67 problems.  :)
68
69 So the quick solution is beep is not beeping when you want it to is:
70
71 $ su
72 Password:
73 # chmod 4755 /usr/bin/beep
74
75 (or wherever you put it)
76
77 The one snag is that this will give any little nitwit the ability to run beep 
78 successfully - make sure this is what you want.  If it isn't, a slightly more 
79 complex fix would be something like:
80
81 # chgrp beep /usr/bin/beep
82 # chmod 4750 /usr/bin/beep
83
84 and then add only beep-worthy users to the 'beep' group.
85
86 Playing Songs
87 -------------
88
89 A surprising number of people have sent in requests, or even patches, to help
90 beep play multiple, different sounds off a single invocation.  I had always
91 thought that if people wanted a more complex melody, they would just do 
92 something like:
93
94 $ cat << EOF > song.sh
95 #!/bin/sh
96 beep <first beep's options>
97 beep <second beep's options>
98 etc...
99 EOF
100
101 Nevertheless, because of repeated and vociferous demand, version 1.2 (and 
102 presumably all later versions) include the -n/--new switch which allows you to
103 use one command line to create multiple beeps.  Check the man page for 
104 details.  I have also had a couple people suggest that I encourage the 
105 development of such shell scripts/command lines, even collect the particularly
106 melodious ones.  Certainly if anyone feels like sending some to me, I will put
107 them somewhere visible, or even include them as a sample.  I think Dvorak's New
108 World Symphony, 4th Movement, for example, would make a lovely shell script.
109 I also wouldn't mind a rendition of BNL's If I had a million dollars.  But by
110 all means, be creative.
111
112 All files copyright (C) Johnathan Nightingale, 2002.
113 All files distributed under the GNU general public license.
114
115
116
117
118
119
120
121