- Adjust parsing function to understand escaped double-quotes in rules.
- Added new test to udev-test.pl to confirm escaped quotes work.
- Bring eudev up to date with systemd pull request $6890.
This commit resolves GitHub issue #187.
This is a slightly adjusted patch/commit from systemd's udev.
Original upstream commit: 8a247d50abb5315adcc64daea10bc836c9d4c6e0
Provided by Franck Bui (GitHub user fbuihuu)
We now verify the existence of uid's before applying them to devicenodes, so change the
test accordingly. We assume that both uid/gid 1 and 2 exist on the test system.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
getopt is usually good at printing out a nice error message when
commandline options are invalid. It distinguishes between an unknown
option and a known option with a missing arg. It is better to let it
do its job and not use opterr=0 unless we actually want to suppress
messages. So remove opterr=0 in the few places where it wasn't really
useful.
When an error in options is encountered, we should not print a lengthy
help() and overwhelm the user, when we know precisely what is wrong
with the commandline. In addition, since help() prints to stdout, it
should not be used except when requested with -h or --help.
Also, simplify things here and there.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
The way the kernel namespaces have been implemented breaks assumptions
udev made regarding uevent sequence numbers. Creating devices in a
namespace "steals" uevents and its sequence numbers from the host. It
confuses the "udevadmin settle" logic, which might block until util a
timeout is reached, even when no uevent is pending.
Remove any assumptions about sequence numbers and deprecate libudev's
API exposing these numbers; none of that can reliably be used anymore
when namespaces are involved.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set). So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Clang is a bit more strict wrt format-nonliterals:
http://clang.llvm.org/docs/LanguageExtensions.html#format-string-checking
Adding these extra printf attributes also makes gcc able to find more
problems. E.g. this patch uncovers a format issue in udev-builtin-path_id.c
Some parts looked intetional about breaking the format-nonliteral check.
I added some supression for warnings there.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
In the process, rename udev_encode_string which is poorly named
for what it does. It deals specifically with encoding names that
udev creates and has its own rules: utf8 is valid but some ascii
is not (e.g. path separators), and everything else is simply escaped.
Rename it to encode_devnode_name.
Adopted for eudev: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
There's now some more obvious overlap amongst the two
utf8 validation functions, but no more than there already
was previously. This also adds some menial tests for anyone
who wants to do more merging of these two in the future.
Adopted for eudev: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit imports strxcpyx from upstream. This is upstream commit
d5a89d7dc17a5ba5cf4fc71f82963c5c94a31c3d
Note: there were also some very minor code cleanups to
accelerometer.c: line 187
collect.c: lines 35, 140
libudev-device.c: line 780
libudev-hwdb.c: line 300
These are part of upstream commits:
507f22bd0172bff5e5d98145b1419bd472a2c57f
3cf7b686e6b29f78de0af5929602cae4482f6d49
67410e9f73a6cdd8453c78b966451b5151def14a
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Two issues are addressed: 1) Makefile.am has to provide config.h
information on HAVE_UNSHARE to test-udev.c. 2) MS_PRIVATE and
MS_REC are defined in <linux/fs.h> which must be directly included
on a uclibc system because of different header stackings. Its
inclusion makes no difference on a glibc system.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
The DISTCLEAN_LOCAL_HOOKS variable is not used by automake when generating
Makefiles. This has been replaced with the clean-local target which does get
used. The clean-local target is defined to be dependent on the
test-sys-distclean target as recommended in the automake manual.
The paths in test-sys-distclean have been corrected to ensure that test/sys is
deleted during 'make distcheck'.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
We move the test-udev.c and test-libudev.c from src/test to test.
This corrects the a problem with hard coded relative paths finding
the test/test/sys directory created by test/udev-test.pl.
This commit draws heavily from nvinson patch in
https://github.com/gentoo/eudev/pull/20
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit reintroduces code to
1) build src/keymap
2) test keymap/Makefile.am that it has all the key maps listed
3) test that all the key names in keymap/* are in <linux/input.h>
4) do a syntax check on rules/*.rules which now includes
95-keymap.rules and 95-keyboard-force-release.rules
For #4, the regex expressions in rule-syntax-check.py had to be
updated. They do not allow trailing comments via # comment, and
I did not include that. A rule in 95-keymap.rules had to have its
comment moved from the end to another line.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
At several points in the forked code, top_srcdir and top_builddir
are mixed up. It is not clear if this is an upstream bug or if this
is a result of the initial restructuring of the build system. This
commit addresses this issue for tests triggered during make distcheck.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
The original Makefile.am was drawn to the top level. This commit
breaks it out into the various directories with SUBDIRS connecting
them. This makes each directory easier to maintain.
This commit is a first attempt to isolate the udev code from the
remaining code base. It intentionally does not modify any files
but purely delete files which, on a first examination, appear to
not be needed. This is a sweeping commit which may easily have
missed needed code. Files can be retrieved by doing a checkout
from the previous commit:
git checkout 2944f347d0 -- <filename>