speakupconf problem and fix

William Hubbs w.d.hubbs at gmail.com
Tue Jun 23 11:36:31 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Adam,

On Mon, Jun 22, 2009 at 08:25:59PM -0500, Adam Myrow wrote:
> The problem is, the version of find in Slackware 12.2 does not recognize 
> the "-readable" and "-writable" options.  I suspect that they are in some 
> newer version of find.  The "find --version" command gives the following on 
> my system.
>
> GNU find version 4.2.31
> Built using GNU gnulib version 2007-02-24
> Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION

You are correct; you are running an old version of findutils.  find
- --version returns the following here:

find (GNU findutils) 4.4.0
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Built using GNU gnulib version e5573b1bad88bfabcda181b9e0125fb0c52b7d3b
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS() CBO(level=0) 

I also looked in my changelogs, and we have had this version of
findutils since march 2008, so it has been around for quite a while.

> I quickly found the solution.  I modified the problem line to look like 
> this.
>
> SAVELIST=`find . -perm -u+rw -type f |sed 's/..//'`
>
> I believe this accomplishes the same thing as the original line, using the 
> "-perm" flag which is a part of find on just about any Unix system in 
> existence.  Does anybody see any problem with having this change made to 
> the GIT version of speakupconf?  It is probably best to use the most 
> portable syntax where possible to avoid future problems like this. Thanks.

Actually it doesn't do the same thing.  The difference is subtile, but
important.

The solution you propose only works if the user running speakupconf is
also the owner of the files in /sys/accessibility/speakup, which is not
necessarily true.  This is because the -perm flag compares its argument
to the permissions of the files.  The -readable and -writable flags, on
the other hand, test to see if the user running the find has permission
to read and write the files even if the user does not own them.  This is what
we want with speakupconf, since it is possible for different users to
have their own preferred speakup settings.  I don't know of a way to
accomplish this easily without the -readable and -writable flags.

For those of you on the list with newer findutils, here is a great
example of the difference:

As a user, run the following two commands:

find /sbin -perm -u+rw -type f -print
find /sbin -readable -writable -type f -print

They give very different results.

If you can come up with another solution that does the same thing we
are looking for (allows a user to save the files they can read and write
regardless of whether they actually own the files), let me know.

Thanks,

William

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkpA9n8ACgkQblQW9DDEZThpBACfWomclS8OUY/aPmomGaf6Da6g
HzgAoLM28hCyiX6jvBE9spXqO9w+QwOb
=j41U
-----END PGP SIGNATURE-----



More information about the Speakup mailing list