Restore pkg file timestamps while unpacking as regular user.
Requested by @dominikh.
This commit is contained in:
parent
3692ecb537
commit
ae8ce64542
3
NEWS
3
NEWS
@ -1,5 +1,8 @@
|
|||||||
xbps-0.44 (???):
|
xbps-0.44 (???):
|
||||||
|
|
||||||
|
* libxbps: file timestamps stored in binary packages are now restored while
|
||||||
|
unpacking as regular user.
|
||||||
|
|
||||||
* xbps-pkgdb(8): this now uses the code from libxbps to check the target file
|
* xbps-pkgdb(8): this now uses the code from libxbps to check the target file
|
||||||
of symlinks. This fixes some false positives with symlinks.
|
of symlinks. This fixes some false positives with symlinks.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2010-2014 Juan Romero Pardines.
|
* Copyright (c) 2010-2015 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -46,10 +46,10 @@
|
|||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \
|
#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \
|
||||||
ARCHIVE_EXTRACT_SECURE_SYMLINKS
|
ARCHIVE_EXTRACT_SECURE_SYMLINKS | \
|
||||||
#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | \
|
ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | \
|
||||||
ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_UNLINK | \
|
ARCHIVE_EXTRACT_UNLINK
|
||||||
EXTRACT_FLAGS
|
#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | EXTRACT_FLAGS
|
||||||
|
|
||||||
#ifndef __UNCONST
|
#ifndef __UNCONST
|
||||||
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||||
|
@ -86,8 +86,33 @@ symlink_relative_target_cwd_body() {
|
|||||||
atf_check_equal $rv 0
|
atf_check_equal $rv 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atf_test_case restore_mtime
|
||||||
|
|
||||||
|
restore_mtime_head() {
|
||||||
|
atf_set "descr" "xbps-create(8): restore file mtime as user"
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_mtime_body() {
|
||||||
|
mkdir -p repo pkg_A/usr/include/gsm
|
||||||
|
touch -f pkg_A/usr/include/gsm/gsm.h
|
||||||
|
|
||||||
|
cd repo
|
||||||
|
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
cd ..
|
||||||
|
xbps-rindex -d -a repo/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-install -r root --repository=repo -yvd foo
|
||||||
|
|
||||||
|
expected=$(stat --printf='%Y' pkg_A/usr/include/gsm/gsm.h)
|
||||||
|
result=$(stat --printf='%Y' root/usr/include/gsm/gsm.h)
|
||||||
|
|
||||||
|
atf_check_equal "$expected" "$result"
|
||||||
|
}
|
||||||
|
|
||||||
atf_init_test_cases() {
|
atf_init_test_cases() {
|
||||||
atf_add_test_case hardlinks_size
|
atf_add_test_case hardlinks_size
|
||||||
atf_add_test_case symlink_relative_target
|
atf_add_test_case symlink_relative_target
|
||||||
atf_add_test_case symlink_relative_target_cwd
|
atf_add_test_case symlink_relative_target_cwd
|
||||||
|
atf_add_test_case restore_mtime
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user