Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154344047
D18913.id53086.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
D18913.id53086.diff
View Options
Index: .gitignore
===================================================================
--- .gitignore
+++ .gitignore
@@ -17,3 +17,4 @@
ID
cscope.out
?cscope.out
+tags
Index: contrib/libarchive/libarchive/archive_read_support_format_ar.c
===================================================================
--- contrib/libarchive/libarchive/archive_read_support_format_ar.c
+++ contrib/libarchive/libarchive/archive_read_support_format_ar.c
@@ -388,9 +388,10 @@
/*
* "/" is the SVR4/GNU archive symbol table.
+ * "/SYM64/" is the SVR4/GNU 64-bit variant archive symbol table.
*/
- if (strcmp(filename, "/") == 0) {
- archive_entry_copy_pathname(entry, "/");
+ if (strcmp(filename, "/") == 0 || strcmp(filename, "/SYM64/") == 0) {
+ archive_entry_copy_pathname(entry, filename);
/* Parse the time, owner, mode, size fields. */
r = ar_parse_common_header(ar, entry, h);
/* Force the file type to a regular file. */
Index: contrib/libarchive/libarchive/archive_write_set_format_ar.c
===================================================================
--- contrib/libarchive/libarchive/archive_write_set_format_ar.c
+++ contrib/libarchive/libarchive/archive_write_set_format_ar.c
@@ -187,6 +187,11 @@
buff[AR_name_offset] = '/';
goto stat;
}
+ if (strcmp(pathname, "/SYM64/") == 0 ) {
+ /* Entry is archive symbol table in GNU 64-bit format */
+ memcpy(buff + AR_name_offset, "/SYM64/", 7);
+ goto stat;
+ }
if (strcmp(pathname, "__.SYMDEF") == 0) {
/* Entry is archive symbol table in BSD format */
memcpy(buff + AR_name_offset, "__.SYMDEF", 9);
Index: usr.bin/ar/ar.h
===================================================================
--- usr.bin/ar/ar.h
+++ usr.bin/ar/ar.h
@@ -100,9 +100,11 @@
/*
* Fields for the archive symbol table.
*/
- uint32_t s_cnt; /* current number of symbols. */
- uint32_t *s_so; /* symbol offset table. */
+ uint64_t s_cnt; /* current number of symbols. */
+ uint64_t *s_so; /* symbol offset table. */
+ uint64_t s_so_max; /* Maximum symbol offset (for determining which ar format to use)*/
size_t s_so_cap; /* capacity of so table buffer. */
+
char *s_sn; /* symbol name table */
size_t s_sn_cap; /* capacity of sn table buffer. */
size_t s_sn_sz; /* current size of sn table. */
Index: usr.bin/ar/read.c
===================================================================
--- usr.bin/ar/read.c
+++ usr.bin/ar/read.c
@@ -109,7 +109,8 @@
break;
/* Skip pseudo members. */
- if (strcmp(name, "/") == 0 || strcmp(name, "//") == 0)
+ if (strcmp(name, "/") == 0 || strcmp(name, "/SYM64/") == 0 ||
+ strcmp(name, "//") == 0)
continue;
if (bsdar->argc > 0) {
Index: usr.bin/ar/write.c
===================================================================
--- usr.bin/ar/write.c
+++ usr.bin/ar/write.c
@@ -50,7 +50,7 @@
#define _ARMAG_LEN 8 /* length of ar magic string */
#define _ARHDR_LEN 60 /* length of ar header */
#define _INIT_AS_CAP 128 /* initial archive string table size */
-#define _INIT_SYMOFF_CAP (256*(sizeof(uint32_t))) /* initial so table size */
+#define _INIT_SYMOFF_CAP (256*(sizeof(uint64_t))) /* initial so table size */
#define _INIT_SYMNAME_CAP 1024 /* initial sn table size */
#define _MAXNAMELEN_SVR4 15 /* max member name length in svr4 variant */
#define _TRUNCATE_LEN 15 /* number of bytes to keep for member name */
@@ -557,6 +557,7 @@
free(bsdar->s_sn);
bsdar->as = NULL;
bsdar->s_so = NULL;
+ bsdar->s_so_max = 0;
bsdar->s_sn = NULL;
}
@@ -613,7 +614,9 @@
struct archive_entry *entry;
size_t s_sz; /* size of archive symbol table. */
size_t pm_sz; /* size of pseudo members */
- int i, nr;
+ size_t w_sz; /* size of words in symbol table */
+ uint64_t nr;
+ int i;
if (elf_version(EV_CURRENT) == EV_NONE)
bsdar_errc(bsdar, EX_SOFTWARE, 0,
@@ -628,9 +631,6 @@
if (strlen(obj->name) > _MAXNAMELEN_SVR4)
add_to_ar_str_table(bsdar, obj->name);
bsdar->rela_off += _ARHDR_LEN + obj->size + obj->size % 2;
- if (bsdar->rela_off > UINT32_MAX)
- bsdar_errc(bsdar, EX_SOFTWARE, 0,
- "Symbol table offset overflow");
}
/*
@@ -657,17 +657,29 @@
* absolute_offset = htobe32(relative_offset + size_of_pseudo_members)
*/
+ w_sz = sizeof(uint32_t);
+ if (bsdar->s_so_max > UINT32_MAX)
+ w_sz = sizeof(uint64_t);
if (bsdar->s_cnt != 0) {
s_sz = (bsdar->s_cnt + 1) * sizeof(uint32_t) + bsdar->s_sn_sz;
pm_sz = _ARMAG_LEN + (_ARHDR_LEN + s_sz);
if (bsdar->as != NULL)
pm_sz += _ARHDR_LEN + bsdar->as_sz;
+ /* Use the 64-bit word size format if necessary. */
+ if (bsdar->s_so_max > UINT32_MAX - pm_sz) {
+ w_sz = sizeof(uint64_t);
+ pm_sz -= s_sz;
+ s_sz = (bsdar->s_cnt + 1) * sizeof(uint64_t) + bsdar->s_sn_sz;
+ pm_sz += s_sz;
+ }
+
for (i = 0; (size_t)i < bsdar->s_cnt; i++) {
- if (*(bsdar->s_so + i) > UINT32_MAX - pm_sz)
- bsdar_errc(bsdar, EX_SOFTWARE, 0,
- "Symbol table offset overflow");
- *(bsdar->s_so + i) = htobe32(*(bsdar->s_so + i) +
- pm_sz);
+ if (w_sz == sizeof(uint32_t))
+ *(bsdar->s_so + i) = (uint64_t)htobe32((uint32_t)(*(bsdar->s_so + i)) +
+ pm_sz);
+ else
+ *(bsdar->s_so + i) = htobe64(*(bsdar->s_so + i) +
+ pm_sz);
}
}
@@ -689,16 +701,27 @@
if (entry == NULL)
bsdar_errc(bsdar, EX_SOFTWARE, 0,
"archive_entry_new failed");
- archive_entry_copy_pathname(entry, "/");
+ if (w_sz == sizeof(uint64_t))
+ archive_entry_copy_pathname(entry, "/SYM64/");
+ else
+ archive_entry_copy_pathname(entry, "/");
if ((bsdar->options & AR_D) == 0)
archive_entry_set_mtime(entry, time(NULL), 0);
archive_entry_set_size(entry, (bsdar->s_cnt + 1) *
- sizeof(uint32_t) + bsdar->s_sn_sz);
+ w_sz + bsdar->s_sn_sz);
AC(archive_write_header(a, entry));
- nr = htobe32(bsdar->s_cnt);
- write_data(bsdar, a, &nr, sizeof(uint32_t));
- write_data(bsdar, a, bsdar->s_so, sizeof(uint32_t) *
- bsdar->s_cnt);
+ if(w_sz == sizeof(uint32_t))
+ nr = (uint64_t)htobe32((uint32_t)bsdar->s_cnt);
+ else
+ nr = htobe64(bsdar->s_cnt);
+ write_data(bsdar, a, &nr, w_sz);
+ if(w_sz == sizeof(uint64_t))
+ write_data(bsdar, a, bsdar->s_so, sizeof(uint64_t) *
+ bsdar->s_cnt);
+ else
+ for (i = 0; (size_t)i < bsdar->s_cnt; i++)
+ write_data(bsdar, a, (uint32_t *)&bsdar->s_so[i],
+ sizeof(uint32_t));
write_data(bsdar, a, bsdar->s_sn, bsdar->s_sn_sz);
archive_entry_free(entry);
}
@@ -904,13 +927,14 @@
bsdar->s_sn_sz = 0;
}
- if (bsdar->s_cnt * sizeof(uint32_t) >= bsdar->s_so_cap) {
+ if (bsdar->s_cnt * sizeof(uint64_t) >= bsdar->s_so_cap) {
bsdar->s_so_cap *= 2;
bsdar->s_so = realloc(bsdar->s_so, bsdar->s_so_cap);
if (bsdar->s_so == NULL)
bsdar_errc(bsdar, EX_SOFTWARE, errno, "realloc failed");
}
- bsdar->s_so[bsdar->s_cnt] = bsdar->rela_off;
+ bsdar->s_so[bsdar->s_cnt] = (uint64_t)bsdar->rela_off;
+ bsdar->s_so_max = (uint64_t)bsdar->rela_off > bsdar->s_so_max ? (uint64_t)bsdar->rela_off : bsdar->s_so_max;
bsdar->s_cnt++;
/*
Index: usr.sbin/freebsd-update/freebsd-update.sh
===================================================================
--- usr.sbin/freebsd-update/freebsd-update.sh
+++ usr.sbin/freebsd-update/freebsd-update.sh
@@ -310,6 +310,7 @@
if echo ${UNAME_r} | grep -qE '^[0-9.]+$'; then
UNAME_r="${UNAME_r}-RELEASE"
fi
+ export UNAME_r
}
# Define what happens to output of utilities
@@ -667,17 +668,23 @@
FETCHDIR=${RELNUM}/${ARCH}
PATCHDIR=${RELNUM}/${ARCH}/bp
- # Disallow upgrade from a version that is not `-RELEASE`
- if ! echo "${RELNUM}" | grep -qE -- "-RELEASE$"; then
- echo -n "`basename $0`: "
- cat <<- EOF
- Cannot upgrade from a version that is not a '-RELEASE' using `basename $0`.
- Instead, FreeBSD can be directly upgraded by source or upgraded to a
- RELEASE/RELENG version prior to running `basename $0`.
- EOF
- echo "System version: ${RELNUM}"
- exit 1
- fi
+ # Disallow upgrade from a version that is not a release
+ case ${RELNUM} in
+ *-RELEASE | *-ALPHA* | *-BETA* | *-RC*)
+ ;;
+ *)
+ echo -n "`basename $0`: "
+ cat <<- EOF
+ Cannot upgrade from a version that is not a release
+ (including alpha, beta and release candidates)
+ using `basename $0`. Instead, FreeBSD can be directly
+ upgraded by source or upgraded to a RELEASE/RELENG version
+ prior to running `basename $0`.
+ Currently running: ${RELNUM}
+ EOF
+ exit 1
+ ;;
+ esac
# Figure out what directory contains the running kernel
BOOTFILE=`sysctl -n kern.bootfile`
@@ -1942,13 +1949,11 @@
# Report to the user if any updates were avoided due to local changes
if [ -s modifiedfiles ]; then
- echo
- echo -n "The following files are affected by updates, "
- echo "but no changes have"
- echo -n "been downloaded because the files have been "
- echo "modified locally:"
- cat modifiedfiles
- fi | $PAGER
+ cat - modifiedfiles <<- EOF | $PAGER
+ The folling files are affected by updates but no changes have
+ been downloaded because the files have been modified locally:
+ EOF
+ fi
rm modifiedfiles
# If no files will be updated, tell the user and exit
@@ -1974,30 +1979,29 @@
# Report removed files, if any
if [ -s files.removed ]; then
- echo
- echo -n "The following files will be removed "
- echo "as part of updating to ${RELNUM}-p${RELPATCHNUM}:"
- cat files.removed
- fi | $PAGER
+ cat - files.removed <<- EOF | $PAGER
+ The following files will be removed as part of updating to
+ ${RELNUM}-p${RELPATCHNUM}:
+ EOF
+ fi
rm files.removed
# Report added files, if any
if [ -s files.added ]; then
- echo
- echo -n "The following files will be added "
- echo "as part of updating to ${RELNUM}-p${RELPATCHNUM}:"
- cat files.added
- fi | $PAGER
+ cat - files.added <<- EOF | $PAGER
+ The following files will be added as part of updating to
+ ${RELNUM}-p${RELPATCHNUM}:
+ EOF
+ fi
rm files.added
# Report updated files, if any
if [ -s files.updated ]; then
- echo
- echo -n "The following files will be updated "
- echo "as part of updating to ${RELNUM}-p${RELPATCHNUM}:"
-
- cat files.updated
- fi | $PAGER
+ cat - files.updated <<- EOF | $PAGER
+ The following files will be updated as part of updating to
+ ${RELNUM}-p${RELPATCHNUM}:
+ EOF
+ fi
rm files.updated
# Create a directory for the install manifest.
@@ -2191,7 +2195,7 @@
sort -k 2,2 -t ' ' > compfreq.present
join -t ' ' -1 2 -2 2 compfreq.present compfreq.total |
while read S P T; do
- if [ ${P} -gt `expr ${T} / 2` ]; then
+ if [ ${T} -ne 0 -a ${P} -gt `expr ${T} / 2` ]; then
echo ${S}
fi
done > comp.present
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 28, 11:49 PM (1 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32312795
Default Alt Text
D18913.id53086.diff (10 KB)
Attached To
Mode
D18913: freebsd-update: open $PAGER only if necessary
Attached
Detach File
Event Timeline
Log In to Comment