]> arthur.barton.de Git - bup.git/commit - lib/bup/_helpers.c
Always publish (l)utimes in helpers when available and fix type conversions.
authorRob Browning <rlb@defaultvalue.org>
Wed, 18 Dec 2013 03:12:06 +0000 (21:12 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 28 Dec 2013 18:45:58 +0000 (12:45 -0600)
commitf48cb8e82fe8a95706aa44ea7c64a0955f342328
tree9adebf52c736d10ef78bc2c065412f91eae73461
parent89d566d25553b0256844bdacd494d7f27f0d45e3
Always publish (l)utimes in helpers when available and fix type conversions.

Previously, bup assumed a timeval was (long, long), which agrees with
glibc.info and (Linux) utimes(2), but POSIX says it's (time_t,
suseconds_t).

Since the types vary (and even if they didn't, Python doesn't provide
safe "time_t" conversions), handle the type conversions more
generically, via ASSIGN_PYLONG_TO_INTEGRAL() and
INTEGRAL_ASSIGNMENT_FITS().

Optimistically assume the latter is sufficient for tv_usec (where we
convert it to a long long) because POSIX guarantees that tv_usec will
be a signed integral.

Whenever available, publish utimes and lutimes independently in
helpers, and run the relevant t/txstat.py tests.  So now, we'll be
running at least some tests on utimensat, lutimes, and utimes whenever
they're available.

A more significant improvement would be to run some broader bup tests
twice, once with utimensat and once with utimes/lutimes, whenever both
are available.

cf. 9ce545703dda3c888081c504863308902ce8c56b

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/_helpers.c
lib/bup/t/txstat.py
lib/bup/xstat.py