Date: Tue, 19 Jan 2021 12:25:06 GMT From: Yoshihiro Takahashi <nyan@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c735bf1ae387 - stable/12 - unzip: Sync with NetBSD upstream. Message-ID: <202101191225.10JCP6Tp059965@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=c735bf1ae3874ce1e9cfa718b95aad628b91f030 commit c735bf1ae3874ce1e9cfa718b95aad628b91f030 Author: Yoshihiro Takahashi <nyan@FreeBSD.org> AuthorDate: 2021-01-02 01:50:08 +0000 Commit: Yoshihiro Takahashi <nyan@FreeBSD.org> CommitDate: 2021-01-19 12:20:53 +0000 unzip: Sync with NetBSD upstream. - Ignore malformed directory entries as created by Dropbox ("/"). (rev 1.24) - Use libarchive 3.x interface: check result for archive_read_free() and don't call archive_read_close manually. (rev 1.23) - Always overwrite symlinks on extraction, ever if they're newer than entries in archive. - Use getline() rather than getdelim(). PR: 231827 Submitted by: ak Reviewed by: mm Obtained from: NetBSD (cherry picked from commit 0cdfa4956424dc816944a84568a4d9900b68f5e3) --- usr.bin/unzip/unzip.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c index c9e53f27ed74..937176111a02 100644 --- a/usr.bin/unzip/unzip.c +++ b/usr.bin/unzip/unzip.c @@ -385,6 +385,13 @@ extract_dir(struct archive *a, struct archive_entry *e, const char *path) { int mode; + /* + * Dropbox likes to create '/' directory entries, just ignore + * such junk. + */ + if (*path == '\0') + return; + mode = archive_entry_mode(e) & 0777; if (mode == 0) mode = 0755; @@ -451,7 +458,7 @@ handle_existing_file(char **path) free(*path); *path = NULL; alen = 0; - len = getdelim(path, &alen, '\n', stdin); + len = getline(path, &alen, stdin); if ((*path)[len - 1] == '\n') (*path)[len - 1] = '\0'; return 0; @@ -601,7 +608,7 @@ recheck: if (lstat(*path, &sb) == 0) { if (u_opt || f_opt) { /* check if up-to-date */ - if ((S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)) && + if (S_ISREG(sb.st_mode) && (sb.st_mtim.tv_sec > mtime.tv_sec || (sb.st_mtim.tv_sec == mtime.tv_sec && sb.st_mtim.tv_nsec >= mtime.tv_nsec))) @@ -916,8 +923,7 @@ unzip(const char *fn) } } - ac(archive_read_close(a)); - (void)archive_read_free(a); + ac(archive_read_free(a)); if (t_opt) { if (error_count > 0) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101191225.10JCP6Tp059965>