Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 399641 - autotools-utils.eclass: autotools-utils_src_prepare() incorrectly detects modified files
Summary: autotools-utils.eclass: autotools-utils_src_prepare() incorrectly detects mod...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Maciej Mrozowski
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-21 19:41 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2012-05-28 07:31 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Determine need of autoreconf through checksums, not mtimes. (Determine-need-of-autoreconf-through-checksums-not.patch,1.28 KB, patch)
2012-01-22 15:05 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis 2012-01-21 19:41:27 UTC
autotools-utils_src_prepare() creates ${T}/.autotools-utils.timestamp, applies patches and compares mtimes of ${T}/.autotools-utils.timestamp and files like configure.ac. ext3 filesystems have 1-second precision, so these files are likely to have the same mtimes, which results in not calling autotools-utils_autoreconf().

'sleep 2' should suffice for /var/tmp/portage on ext3 and FAT filesystems.

--- autotools-utils.eclass
+++ autotools-utils.eclass
@@ -361,6 +361,7 @@
 	local want_autoreconf=${AUTOTOOLS_AUTORECONF}
 
 	touch "${T}"/.autotools-utils.timestamp || die
+	sleep 2
 	[[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
 	epatch_user
 	if [[ ! ${want_autoreconf} ]]; then
Comment 1 Arfrever Frehtes Taifersar Arahesis 2012-01-21 20:21:22 UTC
Alternative solution:

[[ -n "$(grep -E -- '^--- ([^[:space:]]/)?(configure\.ac|configure\.in|Makefile\.am)($|[[:space:]])' "${PATCHES[@]}")" ]]
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-01-21 20:29:57 UTC
Ouch. Sleeping is definitely not a solution. I guess we'll just have to compare checksums of files then.
Comment 3 Sébastien Fabbro (RETIRED) gentoo-dev 2012-01-21 20:36:37 UTC
a parsing solution such as comment #1 sounds less expensive than comparing checksums
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-01-21 20:42:11 UTC
(In reply to comment #3)
> a parsing solution such as comment #1 sounds less expensive than comparing
> checksums

The check is supposed to be triggered by user patches only. I don't really want to copy stuff from epatch_user().
Comment 5 Arfrever Frehtes Taifersar Arahesis 2012-01-21 21:18:53 UTC
Untested code:
local -A checksums=()
local file
while read -d $'\0' -r file; do
	checksums["${file}"]="$(sha512sum "${file}")"
done < <(find "(" -name Makefile.am -o -name configure.ac -o -name configure.in ")" -print0)
epatch_user
for file in "${!checksums[@]}"; do
	if [[ "${checksum[${file}]}" != "$(sha512sum "${file}")" ]]; then
		want_autoreconf=yes
	fi
done
Comment 6 Arfrever Frehtes Taifersar Arahesis 2012-01-21 21:23:52 UTC
(In reply to comment #5)
>     if [[ "${checksum[${file}]}" != "$(sha512sum "${file}")" ]]; then

	if [[ "${checksums[${file}]}" != "$(sha512sum "${file}")" ]]; then
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-01-21 21:57:11 UTC
Overcomplicated as usual :P.

I was thinking more of:

checksums=$(find ... -exec md5sum {} + | sort -k2)
epatch_user
[[ $checksums == $(find ...) ]]

But I'm wondering what would be the best checksumming tool to use. It should be both fast and provided by @system.
Comment 8 Justin Lecher (RETIRED) gentoo-dev 2012-01-22 13:14:48 UTC
*** Bug 399699 has been marked as a duplicate of this bug. ***
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-01-22 15:05:00 UTC
Created attachment 299531 [details, diff]
Determine need of autoreconf through checksums, not mtimes.

Fixes:
Comment 10 Francesco Riosa 2012-01-22 21:37:56 UTC
out of curiosity does `cksum` work also on BSD? I see sys-apps/coreutils is masked on that system
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-01-22 22:46:45 UTC
(In reply to comment #10)
> out of curiosity does `cksum` work also on BSD? I see sys-apps/coreutils is
> masked on that system

I'd appreciate any details on that. I can use 'sum' instead if that one's available.
Comment 12 Francesco Riosa 2012-01-23 00:07:22 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > out of curiosity does `cksum` work also on BSD? I see sys-apps/coreutils is
> > masked on that system
> 
> I'd appreciate any details on that. I can use 'sum' instead if that one's
> available.

digging the internet deeper it seem to be included by posix.2 standard, so it's probably part of every *nix base system.

This page:
http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN1/0586____.HTM
show that also on AIX the output is the same, so probably `cksum` is a safe bet.
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-05-28 07:31:29 UTC
Ah, that was fixed long ago.