Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
debian-packages
Tar
Commits
82e47474
Commit
82e47474
authored
11 years ago
by
Bdale Garbee
Browse files
Options
Downloads
Patches
Plain Diff
cherry-pick an upstream commit at Paul Eggert's suggestion
parent
91f57a5c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
debian/changelog
+7
-0
7 additions, 0 deletions
debian/changelog
debian/patches/link-extraction-fix
+73
-0
73 additions, 0 deletions
debian/patches/link-extraction-fix
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
81 additions
and
0 deletions
debian/changelog
+
7
−
0
View file @
82e47474
tar (1.26+dfsg-6) unstable; urgency=low
* cherry-pick upstream commit at Paul Eggert's suggestion to address link
extraction issue, closes: #452365
-- Bdale Garbee <bdale@gag.com> Fri, 31 May 2013 12:12:35 -0600
tar (1.26+dfsg-5) unstable; urgency=low
[ Wookey ]
...
...
This diff is collapsed.
Click to expand it.
debian/patches/link-extraction-fix
0 → 100644
+
73
−
0
View file @
82e47474
Description: link extraction fix
tar (1.26+dfsg-6) unstable; urgency=low
.
* cherry-pick upstream commit at Paul Eggert's suggestion to address link
extraction issue, closes: #452365
Author: Bdale Garbee <bdale@gag.com>
Bug-Debian: http://bugs.debian.org/452365
--- tar-1.26+dfsg.orig/src/extract.c
+++ tar-1.26+dfsg/src/extract.c
@@ -110,12 +110,15 @@
struct delayed_link
/* The next delayed link in the list. */
struct delayed_link *next;
- /* The device, inode number and ctime of the placeholder. Use
- ctime, not mtime, to make false matches less likely if some
- other process removes the placeholder. */
+ /* The device, inode number and birthtime of the placeholder.
+ birthtime.tv_nsec is negative if the birthtime is not available.
+ Don't use mtime as this would allow for false matches if some
+ other process removes the placeholder. Don't use ctime as
+ this would cause race conditions and other screwups, e.g.,
+ when restoring hard-linked symlinks. */
dev_t dev;
ino_t ino;
- struct timespec ctime;
+ struct timespec birthtime;
/* True if the link is symbolic. */
bool is_symlink;
@@ -268,6 +271,15 @@
set_mode (char const *file_name,
}
}
+/* Return true if A and B are the same birthtimes.
+ Unavailable birthtimes, which have negative tv_nsec members,
+ all compare equal to each other. */
+static bool
+same_birthtime (struct timespec a, struct timespec b)
+{
+ return (a.tv_nsec == b.tv_nsec && (a.tv_nsec < 0 || a.tv_sec == b.tv_sec));
+}
+
/* Check time after successfully setting FILE_NAME's time stamp to T. */
static void
check_time (char const *file_name, struct timespec t)
@@ -1076,7 +1088,7 @@
create_placeholder_file (char *file_name
delayed_link_head = p;
p->dev = st.st_dev;
p->ino = st.st_ino;
- p->ctime = get_stat_ctime (&st);
+ p->birthtime = get_stat_birthtime (&st);
p->is_symlink = is_symlink;
if (is_symlink)
{
@@ -1134,7 +1146,7 @@
extract_link (char *file_name, int typef
if (ds->change_dir == chdir_current
&& ds->dev == st1.st_dev
&& ds->ino == st1.st_ino
- && timespec_cmp (ds->ctime, get_stat_ctime (&st1)) == 0)
+ && same_birthtime (ds->birthtime, get_stat_birthtime (&st1)))
{
struct string_list *p = xmalloc (offsetof (struct string_list, string)
+ strlen (file_name) + 1);
@@ -1500,7 +1512,7 @@
apply_delayed_links (void)
if (fstatat (chdir_fd, source, &st, AT_SYMLINK_NOFOLLOW) == 0
&& st.st_dev == ds->dev
&& st.st_ino == ds->ino
- && timespec_cmp (get_stat_ctime (&st), ds->ctime) == 0)
+ && same_birthtime (get_stat_birthtime (&st), ds->birthtime))
{
/* Unlink the placeholder, then create a hard link if possible,
a symbolic link otherwise. */
This diff is collapsed.
Click to expand it.
debian/patches/series
+
1
−
0
View file @
82e47474
...
...
@@ -2,3 +2,4 @@ doc-hack.diff
longlink-hack.diff
listed03-linux-only
eglibc-2.16-ftbfs-gnulib-nogets
link-extraction-fix
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment