Date: Tue, 16 Jun 2015 21:07:53 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r284467 - in user/cperciva/freebsd-update-build/patches: 10.1-RELEASE 8.4-RELEASE 9.3-RELEASE Message-ID: <201506162107.t5GL7rw0000561@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Tue Jun 16 21:07:53 2015 New Revision: 284467 URL: https://svnweb.freebsd.org/changeset/base/284467 Log: Add recent patches. Added: user/cperciva/freebsd-update-build/patches/10.1-RELEASE/10-EN-15:04.freebsd-update user/cperciva/freebsd-update-build/patches/10.1-RELEASE/10-EN-15:05.ufs user/cperciva/freebsd-update-build/patches/10.1-RELEASE/11-EN-15:06.file user/cperciva/freebsd-update-build/patches/10.1-RELEASE/11-EN-15:07.zfs user/cperciva/freebsd-update-build/patches/10.1-RELEASE/12-SA-15:10.openssl user/cperciva/freebsd-update-build/patches/8.4-RELEASE/28-EN-15:04.freebsd-update user/cperciva/freebsd-update-build/patches/8.4-RELEASE/29-EN-15:06.file user/cperciva/freebsd-update-build/patches/8.4-RELEASE/30-SA-15:10.openssl user/cperciva/freebsd-update-build/patches/9.3-RELEASE/14-EN-15:04.freebsd-update user/cperciva/freebsd-update-build/patches/9.3-RELEASE/15-EN-15:06.file (contents, props changed) user/cperciva/freebsd-update-build/patches/9.3-RELEASE/16-SA-15:10.openssl Added: user/cperciva/freebsd-update-build/patches/10.1-RELEASE/10-EN-15:04.freebsd-update ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/10.1-RELEASE/10-EN-15:04.freebsd-update Tue Jun 16 21:07:53 2015 (r284467) @@ -0,0 +1,152 @@ +Index: usr.sbin/freebsd-update/freebsd-update.8 +=================================================================== +--- usr.sbin/freebsd-update/freebsd-update.8 (revision 282245) ++++ usr.sbin/freebsd-update/freebsd-update.8 (working copy) +@@ -25,7 +25,7 @@ + .\" + .\" $FreeBSD$ + .\" +-.Dd July 14, 2010 ++.Dd March 2, 2015 + .Dt FREEBSD-UPDATE 8 + .Os FreeBSD + .Sh NAME +@@ -36,10 +36,12 @@ + .Op Fl b Ar basedir + .Op Fl d Ar workdir + .Op Fl f Ar conffile ++.Op Fl F + .Op Fl k Ar KEY + .Op Fl r Ar newrelease + .Op Fl s Ar server + .Op Fl t Ar address ++.Op Fl -not-running-from-cron + .Cm command ... + .Sh DESCRIPTION + The +@@ -54,16 +56,16 @@ by the + .Fx + Release Engineering Team, e.g., + .Fx +-7.3-RELEASE and ++9.3-RELEASE and + .Fx +-8.0-RELEASE, but not ++10.1-RELEASE, but not + .Fx +-6.3-STABLE or ++9.3-STABLE or + .Fx +-9.0-CURRENT. ++11-CURRENT. + .Sh OPTIONS + The following options are supported: +-.Bl -tag -width "-f conffile" ++.Bl -tag -width "-r newrelease" + .It Fl b Ar basedir + Operate on a system mounted at + .Ar basedir . +@@ -81,6 +83,10 @@ Read configuration options from + .Ar conffile . + (default: + .Pa /etc/freebsd-update.conf ) ++.It Fl F ++Force ++.Nm Cm fetch ++to proceed where it normally would not, such as an unfinished upgrade + .It Fl k Ar KEY + Trust an RSA key with SHA256 of + .Ar KEY . +@@ -98,12 +104,21 @@ Mail output of + command, if any, to + .Ar address . + (default: root, or as given in the configuration file.) ++.It Fl -not-running-from-cron ++Force ++.Nm Cm fetch ++to proceed when there is no controlling tty. ++This is for use by automated scripts and orchestration tools. ++Please do not run ++.Nm Cm fetch ++from crontab or similar using this flag, see: ++.Nm Cm cron + .El + .Sh COMMANDS + The + .Cm command + can be any one of the following: +-.Bl -tag -width "-f conffile" ++.Bl -tag -width "rollback" + .It Cm fetch + Based on the currently installed world and the configuration + options set, fetch all available binary updates. +Index: usr.sbin/freebsd-update/freebsd-update.sh +=================================================================== +--- usr.sbin/freebsd-update/freebsd-update.sh (revision 282245) ++++ usr.sbin/freebsd-update/freebsd-update.sh (working copy) +@@ -43,12 +43,15 @@ Options: + (default: /var/db/freebsd-update/) + -f conffile -- Read configuration options from conffile + (default: /etc/freebsd-update.conf) ++ -F -- Force a fetch operation to proceed + -k KEY -- Trust an RSA key with SHA256 hash of KEY + -r release -- Target for upgrade (e.g., 6.2-RELEASE) + -s server -- Server from which to fetch updates + (default: update.FreeBSD.org) + -t address -- Mail output of cron command, if any, to address + (default: root) ++ --not-running-from-cron ++ -- Run without a tty, for use by automated tools + Commands: + fetch -- Fetch updates from server + cron -- Sleep rand(3600) seconds, fetch updates, and send an +@@ -399,6 +402,12 @@ init_params () { + + # No commands specified yet + COMMANDS="" ++ ++ # Force fetch to proceed ++ FORCEFETCH=0 ++ ++ # Run without a TTY ++ NOTTYOK=0 + } + + # Parse the command line +@@ -411,6 +420,12 @@ parse_cmdline () { + if [ ! -z "${CONFFILE}" ]; then usage; fi + shift; CONFFILE="$1" + ;; ++ -F) ++ FORCEFETCH=1 ++ ;; ++ --not-running-from-cron) ++ NOTTYOK=1 ++ ;; + + # Configuration file equivalents + -b) +@@ -665,6 +680,14 @@ fetch_check_params () { + echo "(Did you mean 'upgrade' instead?)" + exit 1 + fi ++ ++ # Check that we have updates ready to install ++ if [ -f ${BDHASH}-install/kerneldone -a $FORCEFETCH -eq 0 ]; then ++ echo "You have a partially completed upgrade pending" ++ echo "Run '$0 install' first." ++ echo "Run '$0 fetch -F' to proceed anyway." ++ exit 1 ++ fi + } + + # Perform sanity checks etc. before fetching upgrades. +@@ -3202,7 +3225,7 @@ get_params () { + # Fetch command. Make sure that we're being called + # interactively, then run fetch_check_params and fetch_run + cmd_fetch () { +- if [ ! -t 0 ]; then ++ if [ ! -t 0 -a $NOTTYOK -eq 0 ]; then + echo -n "`basename $0` fetch should not " + echo "be run non-interactively." + echo "Run `basename $0` cron instead." Added: user/cperciva/freebsd-update-build/patches/10.1-RELEASE/10-EN-15:05.ufs ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/10.1-RELEASE/10-EN-15:05.ufs Tue Jun 16 21:07:53 2015 (r284467) @@ -0,0 +1,313 @@ +Index: sys/ufs/ffs/ffs_softdep.c +=================================================================== +--- sys/ufs/ffs/ffs_softdep.c (revision 282245) ++++ sys/ufs/ffs/ffs_softdep.c (working copy) +@@ -735,9 +735,10 @@ static struct malloc_type *memtype[] = { + static void check_clear_deps(struct mount *); + static void softdep_error(char *, int); + static int softdep_process_worklist(struct mount *, int); +-static int softdep_waitidle(struct mount *); ++static int softdep_waitidle(struct mount *, int); + static void drain_output(struct vnode *); + static struct buf *getdirtybuf(struct buf *, struct rwlock *, int); ++static int check_inodedep_free(struct inodedep *); + static void clear_remove(struct mount *); + static void clear_inodedeps(struct mount *); + static void unlinked_inodedep(struct mount *, struct inodedep *); +@@ -1377,6 +1378,10 @@ softdep_flush(addr) + mp = (struct mount *)addr; + ump = VFSTOUFS(mp); + atomic_add_int(&stat_flush_threads, 1); ++ ACQUIRE_LOCK(ump); ++ ump->softdep_flags &= ~FLUSH_STARTING; ++ wakeup(&ump->softdep_flushtd); ++ FREE_LOCK(ump); + if (print_threads) { + if (stat_flush_threads == 1) + printf("Running %s at pid %d\n", bufdaemonproc->p_comm, +@@ -1389,7 +1394,7 @@ softdep_flush(addr) + VFSTOUFS(mp)->softdep_jblocks->jb_suspended)) + kthread_suspend_check(); + ACQUIRE_LOCK(ump); +- if ((ump->softdep_flags & FLUSH_CLEANUP) == 0) ++ if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) == 0) + msleep(&ump->softdep_flushtd, LOCK_PTR(ump), PVM, + "sdflush", hz / 2); + ump->softdep_flags &= ~FLUSH_CLEANUP; +@@ -1419,11 +1424,9 @@ worklist_speedup(mp) + + ump = VFSTOUFS(mp); + LOCK_OWNED(ump); +- if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) == 0) { ++ if ((ump->softdep_flags & (FLUSH_CLEANUP | FLUSH_EXIT)) == 0) + ump->softdep_flags |= FLUSH_CLEANUP; +- if (ump->softdep_flushtd->td_wchan == &ump->softdep_flushtd) +- wakeup(&ump->softdep_flushtd); +- } ++ wakeup(&ump->softdep_flushtd); + } + + static int +@@ -1468,14 +1471,10 @@ softdep_speedup(ump) + TAILQ_INSERT_TAIL(&softdepmounts, sdp, sd_next); + FREE_GBLLOCK(&lk); + if ((altump->softdep_flags & +- (FLUSH_CLEANUP | FLUSH_EXIT)) == 0) { ++ (FLUSH_CLEANUP | FLUSH_EXIT)) == 0) + altump->softdep_flags |= FLUSH_CLEANUP; +- altump->um_softdep->sd_cleanups++; +- if (altump->softdep_flushtd->td_wchan == +- &altump->softdep_flushtd) { +- wakeup(&altump->softdep_flushtd); +- } +- } ++ altump->um_softdep->sd_cleanups++; ++ wakeup(&altump->softdep_flushtd); + FREE_LOCK(altump); + } + } +@@ -1887,8 +1886,8 @@ softdep_flushworklist(oldmnt, countp, td + struct thread *td; + { + struct vnode *devvp; +- int count, error = 0; + struct ufsmount *ump; ++ int count, error; + + /* + * Alternately flush the block device associated with the mount +@@ -1897,6 +1896,7 @@ softdep_flushworklist(oldmnt, countp, td + * are found. + */ + *countp = 0; ++ error = 0; + ump = VFSTOUFS(oldmnt); + devvp = ump->um_devvp; + while ((count = softdep_process_worklist(oldmnt, 1)) > 0) { +@@ -1904,36 +1904,47 @@ softdep_flushworklist(oldmnt, countp, td + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); + error = VOP_FSYNC(devvp, MNT_WAIT, td); + VOP_UNLOCK(devvp, 0); +- if (error) ++ if (error != 0) + break; + } + return (error); + } + ++#define SU_WAITIDLE_RETRIES 20 + static int +-softdep_waitidle(struct mount *mp) ++softdep_waitidle(struct mount *mp, int flags __unused) + { + struct ufsmount *ump; +- int error; +- int i; ++ struct vnode *devvp; ++ struct thread *td; ++ int error, i; + + ump = VFSTOUFS(mp); ++ devvp = ump->um_devvp; ++ td = curthread; ++ error = 0; + ACQUIRE_LOCK(ump); +- for (i = 0; i < 10 && ump->softdep_deps; i++) { ++ for (i = 0; i < SU_WAITIDLE_RETRIES && ump->softdep_deps != 0; i++) { + ump->softdep_req = 1; +- if (ump->softdep_on_worklist) +- panic("softdep_waitidle: work added after flush."); +- msleep(&ump->softdep_deps, LOCK_PTR(ump), PVM, "softdeps", 1); ++ KASSERT((flags & FORCECLOSE) == 0 || ++ ump->softdep_on_worklist == 0, ++ ("softdep_waitidle: work added after flush")); ++ msleep(&ump->softdep_deps, LOCK_PTR(ump), PVM | PDROP, ++ "softdeps", 10 * hz); ++ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); ++ error = VOP_FSYNC(devvp, MNT_WAIT, td); ++ VOP_UNLOCK(devvp, 0); ++ if (error != 0) ++ break; ++ ACQUIRE_LOCK(ump); + } + ump->softdep_req = 0; +- FREE_LOCK(ump); +- error = 0; +- if (i == 10) { ++ if (i == SU_WAITIDLE_RETRIES && error == 0 && ump->softdep_deps != 0) { + error = EBUSY; + printf("softdep_waitidle: Failed to flush worklist for %p\n", + mp); + } +- ++ FREE_LOCK(ump); + return (error); + } + +@@ -1990,7 +2001,7 @@ retry_flush: + error = EBUSY; + } + if (!error) +- error = softdep_waitidle(oldmnt); ++ error = softdep_waitidle(oldmnt, flags); + if (!error) { + if (oldmnt->mnt_kern_flag & MNTK_UNMOUNT) { + retry = 0; +@@ -2490,9 +2501,18 @@ softdep_mount(devvp, mp, fs, cred) + /* + * Start our flushing thread in the bufdaemon process. + */ ++ ACQUIRE_LOCK(ump); ++ ump->softdep_flags |= FLUSH_STARTING; ++ FREE_LOCK(ump); + kproc_kthread_add(&softdep_flush, mp, &bufdaemonproc, + &ump->softdep_flushtd, 0, 0, "softdepflush", "%s worker", + mp->mnt_stat.f_mntonname); ++ ACQUIRE_LOCK(ump); ++ while ((ump->softdep_flags & FLUSH_STARTING) != 0) { ++ msleep(&ump->softdep_flushtd, LOCK_PTR(ump), PVM, "sdstart", ++ hz / 2); ++ } ++ FREE_LOCK(ump); + /* + * When doing soft updates, the counters in the + * superblock may have gotten out of sync. Recomputation +@@ -7629,17 +7649,13 @@ check_inode_unwritten(inodedep) + return (1); + } + +-/* +- * Try to free an inodedep structure. Return 1 if it could be freed. +- */ + static int +-free_inodedep(inodedep) ++check_inodedep_free(inodedep) + struct inodedep *inodedep; + { + + LOCK_OWNED(VFSTOUFS(inodedep->id_list.wk_mp)); +- if ((inodedep->id_state & (ONWORKLIST | UNLINKED)) != 0 || +- (inodedep->id_state & ALLCOMPLETE) != ALLCOMPLETE || ++ if ((inodedep->id_state & ALLCOMPLETE) != ALLCOMPLETE || + !LIST_EMPTY(&inodedep->id_dirremhd) || + !LIST_EMPTY(&inodedep->id_pendinghd) || + !LIST_EMPTY(&inodedep->id_bufwait) || +@@ -7654,6 +7670,21 @@ free_inodedep(inodedep) + inodedep->id_nlinkdelta != 0 || + inodedep->id_savedino1 != NULL) + return (0); ++ return (1); ++} ++ ++/* ++ * Try to free an inodedep structure. Return 1 if it could be freed. ++ */ ++static int ++free_inodedep(inodedep) ++ struct inodedep *inodedep; ++{ ++ ++ LOCK_OWNED(VFSTOUFS(inodedep->id_list.wk_mp)); ++ if ((inodedep->id_state & (ONWORKLIST | UNLINKED)) != 0 || ++ !check_inodedep_free(inodedep)) ++ return (0); + if (inodedep->id_state & ONDEPLIST) + LIST_REMOVE(inodedep, id_deps); + LIST_REMOVE(inodedep, id_hash); +@@ -13838,7 +13869,8 @@ softdep_check_suspend(struct mount *mp, + { + struct bufobj *bo; + struct ufsmount *ump; +- int error; ++ struct inodedep *inodedep; ++ int error, unlinked; + + bo = &devvp->v_bufobj; + ASSERT_BO_WLOCKED(bo); +@@ -13899,6 +13931,20 @@ softdep_check_suspend(struct mount *mp, + break; + } + ++ unlinked = 0; ++ if (MOUNTEDSUJ(mp)) { ++ for (inodedep = TAILQ_FIRST(&ump->softdep_unlinked); ++ inodedep != NULL; ++ inodedep = TAILQ_NEXT(inodedep, id_unlinked)) { ++ if ((inodedep->id_state & (UNLINKED | UNLINKLINKS | ++ UNLINKONLIST)) != (UNLINKED | UNLINKLINKS | ++ UNLINKONLIST) || ++ !check_inodedep_free(inodedep)) ++ continue; ++ unlinked++; ++ } ++ } ++ + /* + * Reasons for needing more work before suspend: + * - Dirty buffers on devvp. +@@ -13908,8 +13954,8 @@ softdep_check_suspend(struct mount *mp, + error = 0; + if (bo->bo_numoutput > 0 || + bo->bo_dirty.bv_cnt > 0 || +- softdep_depcnt != 0 || +- ump->softdep_deps != 0 || ++ softdep_depcnt != unlinked || ++ ump->softdep_deps != unlinked || + softdep_accdepcnt != ump->softdep_accdeps || + secondary_writes != 0 || + mp->mnt_secondary_writes != 0 || +Index: sys/ufs/ffs/ffs_vfsops.c +=================================================================== +--- sys/ufs/ffs/ffs_vfsops.c (revision 282245) ++++ sys/ufs/ffs/ffs_vfsops.c (working copy) +@@ -1502,8 +1502,11 @@ ffs_sync(mp, waitfor) + if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) + panic("%s: ffs_sync: modification on read-only filesystem", + fs->fs_fsmnt); +- if (waitfor == MNT_LAZY) +- return (ffs_sync_lazy(mp)); ++ if (waitfor == MNT_LAZY) { ++ if (!rebooting) ++ return (ffs_sync_lazy(mp)); ++ waitfor = MNT_NOWAIT; ++ } + + /* + * Write back each (modified) inode. +@@ -1560,7 +1563,7 @@ loop: + /* + * Force stale filesystem control information to be flushed. + */ +- if (waitfor == MNT_WAIT) { ++ if (waitfor == MNT_WAIT || rebooting) { + if ((error = softdep_flushworklist(ump->um_mountp, &count, td))) + allerror = error; + /* Flushed work items may create new vnodes to clean */ +@@ -1577,9 +1580,12 @@ loop: + if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0) { + BO_UNLOCK(bo); + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); +- if ((error = VOP_FSYNC(devvp, waitfor, td)) != 0) +- allerror = error; ++ error = VOP_FSYNC(devvp, waitfor, td); + VOP_UNLOCK(devvp, 0); ++ if (MOUNTEDSOFTDEP(mp) && (error == 0 || error == EAGAIN)) ++ error = ffs_sbupdate(ump, waitfor, 0); ++ if (error != 0) ++ allerror = error; + if (allerror == 0 && waitfor == MNT_WAIT) + goto loop; + } else if (suspend != 0) { +Index: sys/ufs/ffs/softdep.h +=================================================================== +--- sys/ufs/ffs/softdep.h (revision 282245) ++++ sys/ufs/ffs/softdep.h (working copy) +@@ -1063,6 +1063,8 @@ struct mount_softdeps { + */ + #define FLUSH_EXIT 0x0001 /* time to exit */ + #define FLUSH_CLEANUP 0x0002 /* need to clear out softdep structures */ ++#define FLUSH_STARTING 0x0004 /* flush thread not yet started */ ++ + /* + * Keep the old names from when these were in the ufsmount structure. + */ Added: user/cperciva/freebsd-update-build/patches/10.1-RELEASE/11-EN-15:06.file ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/10.1-RELEASE/11-EN-15:06.file Tue Jun 16 21:07:53 2015 (r284467) @@ -0,0 +1,6603 @@ +Index: contrib/file/ChangeLog +=================================================================== +--- contrib/file/ChangeLog (revision 284174) ++++ contrib/file/ChangeLog (working copy) +@@ -1,3 +1,97 @@ ++2015-01-02 15:15 Christos Zoulas <christos@zoulas.com> ++ ++ * release 5.22 ++ ++2015-01-01 12:01 Christos Zoulas <christos@zoulas.com> ++ ++ * add indirect relative for TIFF/Exif ++ ++2014-12-16 18:10 Christos Zoulas <christos@zoulas.com> ++ ++ * restructure elf note printing to avoid repeated messages ++ * add note limit, suggested by Alexander Cherepanov ++ ++2014-12-16 16:53 Christos Zoulas <christos@zoulas.com> ++ ++ * Bail out on partial pread()'s (Alexander Cherepanov) ++ * Fix incorrect bounds check in file_printable (Alexander Cherepanov) ++ ++2014-12-11 20:01 Christos Zoulas <christos@zoulas.com> ++ ++ * PR/405: ignore SIGPIPE from uncompress programs ++ * change printable -> file_printable and use it in ++ more places for safety ++ * in ELF, instead of "(uses dynamic libraries)" when PT_INTERP ++ is present print the interpreter name. ++ ++2014-12-10 20:01 Christos Zoulas <christos@zoulas.com> ++ ++ * release 5.21 ++ ++2014-11-27 18:40 Christos Zoulas <christos@zoulas.com> ++ ++ * Allow setting more parameters from the command line. ++ * Split name/use and indirect magic recursion limits. ++ ++2014-11-27 11:12 Christos Zoulas <christos@zoulas.com> ++ ++ * Adjust ELF parameters and the default recursion ++ level. ++ * Allow setting the recursion level dynamically. ++ ++2014-11-24 8:55 Christos Zoulas <christos@zoulas.com> ++ ++ * The following fixes resulted from Thomas Jarosch's fuzzing ++ tests that revealed severe performance issues on pathological ++ input: ++ - limit number of elf program and sections processing ++ - abort elf note processing quickly ++ - reduce the number of recursion levels from 20 to 10 ++ - preserve error messages in indirect magic handling ++ ++ This is tracked as CVE-2014-8116 and CVE-2014-8117 ++ ++2014-11-12 10:30 Christos Zoulas <christos@zoulas.com> ++ ++ * fix bogus free in the user buffer case. ++ ++2014-11-11 12:35 Christos Zoulas <christos@zoulas.com> ++ ++ * fix out of bounds read for pascal strings ++ * fix memory leak (not freeing the head of each mlist) ++ ++2014-11-07 10:25 Christos Zoulas <christos@zoulas.com> ++ ++ * When printing strings from a file, convert them to printable ++ on a byte by byte basis, so that we don't get issues with ++ locale's trying to interpret random byte streams as UTF-8 and ++ having printf error out with EILSEQ. ++ ++2014-10-17 11:48 Christos Zoulas <christos@zoulas.com> ++ ++ * fix bounds in note reading (Francisco Alonso / Red Hat) ++ ++2014-10-11 15:02 Christos Zoulas <christos@zoulas.com> ++ ++ * fix autoconf glue for setlocale and locale_t; some OS's ++ have locale_t in xlocale.h ++ ++2014-10-10 15:01 Christos Zoulas <christos@zoulas.com> ++ ++ * release 5.20 ++ ++2014-08-17 10:01 Christos Zoulas <christos@zoulas.com> ++ ++ * recognize encrypted CDF documents ++ ++2014-08-04 9:18 Christos Zoulas <christos@zoulas.com> ++ ++ * add magic_load_buffers from Brooks Davis ++ ++2014-07-24 16:40 Christos Zoulas <christos@zoulas.com> ++ ++ * add thumbs.db support ++ + 2014-06-12 12:28 Christos Zoulas <christos@zoulas.com> + + * release 5.19 +Index: contrib/file/README +=================================================================== +--- contrib/file/README (revision 284174) ++++ contrib/file/README (working copy) +@@ -1,6 +1,6 @@ + ## README for file(1) Command ## + +- @(#) $File: README,v 1.48 2014/03/07 13:55:30 christos Exp $ ++ @(#) $File: README,v 1.49 2015/01/02 20:23:04 christos Exp $ + + Mailing List: file@mx.gw.com + Mailing List archives: http://mx.gw.com/pipermail/file/ +@@ -25,8 +25,8 @@ A public read-only git repository of the same sour + + https://github.com/file/file + +-The major changes for 5.x are CDF file parsing, indirect magic, and +-overhaul in mime and ascii encoding handling. ++The major changes for 5.x are CDF file parsing, indirect magic, name/use ++(recursion) and overhaul in mime and ascii encoding handling. + + The major feature of 4.x is the refactoring of the code into a library, + and the re-write of the file command in terms of that library. The library +@@ -67,33 +67,41 @@ in magic(5) format please, to the maintainer, Chri + COPYING - read this first. + README - read this second (you are currently reading this file). + INSTALL - read on how to install +- + src/apprentice.c - parses /etc/magic to learn magic ++src/asctime_r.c - replacement for OS's that don't have it. + src/apptype.c - used for OS/2 specific application type magic + src/asprintf.c - replacement for OS's that don't have it. + src/ascmagic.c - third & last set of tests, based on hardwired assumptions. +-src/asctime_r.c - for systems that don't have it. +-src/asprintf.c - for systems that don't have it. +-src/cdf.c - parser for Microsoft Compound Document Files ++src/asctime_r.c - replacement for OS's that don't have it. ++src/asprintf.c - replacement for OS's that don't have it. ++src/cdf.[ch] - parser for Microsoft Compound Document Files + src/cdf_time.c - time converter for CDF. + src/compress.c - handles decompressing files to look inside. +-src/ctime_r.c - for systems that don't have it. ++src/ctime_r.c - replacement for OS's that don't have it. ++src/elfclass.h - common code for elf 32/64. + src/encoding.c - handles unicode encodings + src/file.c - the main program + src/file.h - header file ++src/file_opts.h - list of options ++src/fmtcheck.c - replacement for OS's that don't have it. + src/fsmagic.c - first set of tests the program runs, based on filesystem info + src/funcs.c - utilility functions +-src/getopt_long.c - for systems that don't have it. +-src/getline.c - for systems that don't have it. ++src/getline.c - replacement for OS's that don't have it. ++src/getopt_long.c - replacement for OS's that don't have it. + src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore). + src/names.h - header file for ascmagic.c ++src/magic.h.in - source file for magic.h + src/magic.c - the libmagic api ++src/pread.c - replacement for OS's that don't have it. + src/print.c - print results, errors, warnings. + src/readcdf.c - CDF wrapper. + src/readelf.[ch] - Stand-alone elf parsing code. + src/softmagic.c - 2nd set of tests, based on /etc/magic +-src/strlcat.c - for systems that don't have it. +-src/strlcpy.c - for systems that don't have it. ++src/mygetopt.h - replacement for OS's that don't have it. ++src/strcasestr.c - replacement for OS's that don't have it. ++src/strlcat.c - replacement for OS's that don't have it. ++src/strlcpy.c - replacement for OS's that don't have it. ++src/tar.h - tar file definitions + src/vasprintf.c - for systems that don't have it. + doc/file.man - man page for the command + doc/magic.man - man page for the magic file, courtesy Guy Harris. +Index: contrib/file/TODO +=================================================================== +--- contrib/file/TODO (revision 284174) ++++ contrib/file/TODO (working copy) +@@ -15,3 +15,5 @@ small amount of C is needed (because fast executio + required for soft magic, not the more detailed information given by + hard-wired routines). In this regard, note that hplip, which is + BSD-licensed, has a magic reimplementation in Python. ++ ++Read the kerberos magic entry for more ideas. +Index: contrib/file/config.h.in +=================================================================== +--- contrib/file/config.h.in (revision 284174) ++++ contrib/file/config.h.in (working copy) +@@ -44,6 +44,9 @@ + /* Define to 1 if you have the `fork' function. */ + #undef HAVE_FORK + ++/* Define to 1 if you have the `freelocale' function. */ ++#undef HAVE_FREELOCALE ++ + /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ + #undef HAVE_FSEEKO + +@@ -95,9 +98,15 @@ + /* Define to 1 if you have a working `mmap' system call. */ + #undef HAVE_MMAP + ++/* Define to 1 if you have the `newlocale' function. */ ++#undef HAVE_NEWLOCALE ++ + /* Define to 1 if you have the `pread' function. */ + #undef HAVE_PREAD + ++/* Define to 1 if you have the `setlocale' function. */ ++#undef HAVE_SETLOCALE ++ + /* Define to 1 if you have the <stddef.h> header file. */ + #undef HAVE_STDDEF_H + +@@ -182,6 +191,9 @@ + /* Define to 1 if you have the <unistd.h> header file. */ + #undef HAVE_UNISTD_H + ++/* Define to 1 if you have the `uselocale' function. */ ++#undef HAVE_USELOCALE ++ + /* Define to 1 if you have the `utime' function. */ + #undef HAVE_UTIME + +@@ -219,6 +231,9 @@ + /* Define to 1 if `vfork' works. */ + #undef HAVE_WORKING_VFORK + ++/* Define to 1 if you have the <xlocale.h> header file. */ ++#undef HAVE_XLOCALE_H ++ + /* Define to 1 if you have the <zlib.h> header file. */ + #undef HAVE_ZLIB_H + +Index: contrib/file/configure +=================================================================== +--- contrib/file/configure (revision 284174) ++++ contrib/file/configure (working copy) +@@ -1,6 +1,6 @@ + #! /bin/sh + # Guess values for system-dependent variables and create Makefiles. +-# Generated by GNU Autoconf 2.69 for file 5.19. ++# Generated by GNU Autoconf 2.69 for file 5.22. + # + # Report bugs to <christos@astron.com>. + # +@@ -590,8 +590,8 @@ MAKEFLAGS= + # Identity of this package. + PACKAGE_NAME='file' + PACKAGE_TARNAME='file' +-PACKAGE_VERSION='5.19' +-PACKAGE_STRING='file 5.19' ++PACKAGE_VERSION='5.22' ++PACKAGE_STRING='file 5.22' + PACKAGE_BUGREPORT='christos@astron.com' + PACKAGE_URL='' + +@@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +-\`configure' configures file 5.19 to adapt to many kinds of systems. ++\`configure' configures file 5.22 to adapt to many kinds of systems. + + Usage: $0 [OPTION]... [VAR=VALUE]... + +@@ -1397,7 +1397,7 @@ fi + + if test -n "$ac_init_help"; then + case $ac_init_help in +- short | recursive ) echo "Configuration of file 5.19:";; ++ short | recursive ) echo "Configuration of file 5.22:";; + esac + cat <<\_ACEOF + +@@ -1507,7 +1507,7 @@ fi + test -n "$ac_init_help" && exit $ac_status + if $ac_init_version; then + cat <<\_ACEOF +-file configure 5.19 ++file configure 5.22 + generated by GNU Autoconf 2.69 + + Copyright (C) 2012 Free Software Foundation, Inc. +@@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF + This file contains any messages produced by compilers while + running configure, to aid debugging if configure makes a mistake. + +-It was created by file $as_me 5.19, which was ++It was created by file $as_me 5.22, which was + generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ +@@ -3029,7 +3029,7 @@ fi + + # Define the identity of the package. + PACKAGE='file' +- VERSION='5.19' ++ VERSION='5.22' + + + cat >>confdefs.h <<_ACEOF +@@ -12785,7 +12785,7 @@ fi + + done + +-for ac_header in getopt.h err.h ++for ac_header in getopt.h err.h xlocale.h + do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` + ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +@@ -14191,7 +14191,7 @@ fi + fi + + +-for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof ++for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale + do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +@@ -14998,7 +14998,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + # report actual input values of CONFIG_FILES etc. instead of their + # values after options handling. + ac_log=" +-This file was extended by file $as_me 5.19, which was ++This file was extended by file $as_me 5.22, which was + generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES +@@ -15064,7 +15064,7 @@ _ACEOF + cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" + ac_cs_version="\\ +-file config.status 5.19 ++file config.status 5.22 + configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Index: contrib/file/configure.ac +=================================================================== +--- contrib/file/configure.ac (revision 284174) ++++ contrib/file/configure.ac (working copy) +@@ -1,5 +1,5 @@ + dnl Process this file with autoconf to produce a configure script. +-AC_INIT([file],[5.19],[christos@astron.com]) ++AC_INIT([file],[5.22],[christos@astron.com]) + AM_INIT_AUTOMAKE([subdir-objects foreign]) + m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +@@ -82,7 +82,7 @@ AC_HEADER_MAJOR + AC_HEADER_SYS_WAIT + AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) + AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) +-AC_CHECK_HEADERS(getopt.h err.h) ++AC_CHECK_HEADERS(getopt.h err.h xlocale.h) + AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) + AC_CHECK_HEADERS(zlib.h) + +@@ -138,7 +138,7 @@ else + fi]) + + dnl Checks for functions +-AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof) ++AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) + + dnl Provide implementation of some required functions if necessary + AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck) +Index: contrib/file/doc/file.man +=================================================================== +--- contrib/file/doc/file.man (revision 284174) ++++ contrib/file/doc/file.man (working copy) +@@ -1,5 +1,5 @@ +-.\" $File: file.man,v 1.106 2014/03/07 23:11:51 christos Exp $ +-.Dd January 30, 2014 ++.\" $File: file.man,v 1.111 2014/12/16 23:18:40 christos Exp $ ++.Dd December 16, 2014 + .Dt FILE __CSECTION__ + .Os + .Sh NAME +@@ -16,6 +16,7 @@ + .Op Fl F Ar separator + .Op Fl f Ar namefile + .Op Fl m Ar magicfiles ++.Op Fl P Ar name=value + .Ar + .Ek + .Nm +@@ -303,6 +304,16 @@ or + attempt to preserve the access time of files analyzed, to pretend that + .Nm + never read them. ++.It Fl P , Fl Fl parameter Ar name=value ++Set various parameter limits. ++.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent ++.It Sy "Name" Ta Sy "Default" Ta Sy "Explanation" ++.It Li indir Ta 15 Ta recursion limit for indirect magic ++.It Li name Ta 30 Ta use count limit for name/use magic ++.It Li elf_notes Ta 256 Ta max ELF notes processed ++.It Li elf_phnum Ta 128 Ta max ELF program sections processed ++.It Li elf_shnum Ta 32768 Ta max ELF sections processed ++.El + .It Fl r , Fl Fl raw + Don't translate unprintable characters to \eooo. + Normally +@@ -385,6 +396,7 @@ options. + .Xr hexdump 1 , + .Xr od 1 , + .Xr strings 1 , ++.Xr fstyp 8 + .Sh STANDARDS CONFORMANCE + This program is believed to exceed the System V Interface Definition + of FILE(CMD), as near as one can determine from the vague language +Index: contrib/file/doc/libmagic.man +=================================================================== +--- contrib/file/doc/libmagic.man (revision 284174) ++++ contrib/file/doc/libmagic.man (working copy) +@@ -1,4 +1,4 @@ +-.\" $File: libmagic.man,v 1.28 2014/03/02 14:47:16 christos Exp $ ++.\" $File: libmagic.man,v 1.34 2014/12/16 23:18:40 christos Exp $ + .\" + .\" Copyright (c) Christos Zoulas 2003. + .\" All Rights Reserved. +@@ -25,7 +25,7 @@ + .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + .\" SUCH DAMAGE. + .\" +-.Dd January 6, 2012 ++.Dd December 16, 2014 + .Dt LIBMAGIC 3 + .Os + .Sh NAME +@@ -40,6 +40,9 @@ + .Nm magic_compile , + .Nm magic_list , + .Nm magic_load , ++.Nm magic_load_buffers , ++.Nm magic_setparam , ++.Nm magic_getparam , + .Nm magic_version + .Nd Magic number recognition library + .Sh LIBRARY +@@ -71,6 +74,12 @@ + .Ft int + .Fn magic_load "magic_t cookie" "const char *filename" + .Ft int ++.Fn magic_load_buffers "magic_t cookie" "void **buffers" "size_t *sizes" "size_t nbuffers" ++.Ft int ++.Fn magic_getparam "magic_t cookie" "int param" "void *value" ++.Ft int ++.Fn magic_setparam "magic_t cookie" "int param" "const void *value" ++.Ft int + .Fn magic_version "void" + .Sh DESCRIPTION + These functions +@@ -253,6 +262,60 @@ adds + to the database filename as appropriate. + .Pp + The ++.Fn magic_load_buffers ++function takes an array of size ++.Fa nbuffers ++of ++.Fa buffers ++with a respective size for each in the array of ++.Fa sizes ++loaded with the contents of the magic databases from the filesystem. ++This function can be used in environment where the magic library does ++not have direct access to the filesystem, but can access the magic ++database via shared memory or other IPC means. ++.Pp ++The ++.Fn magic_getparam ++and ++.Fn magic_setparam ++allow getting and setting various limits related to the the magic ++library. ++.Bl -column "MAGIC_PARAM_ELF_PHNUM_MAX" "size_t" "Default" -offset indent ++.It Sy "Parameter" Ta Sy "Type" Ta Sy "Default" ++.It Li MAGIC_PARAM_INDIR_MAX Ta size_t Ta 15 ++.It Li MAGIC_PARAM_NAME_MAX Ta size_t Ta 30 ++.It Li MAGIC_PARAM_ELF_NOTES_MAX Ta size_t Ta 256 ++.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128 ++.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768 ++.El ++.Pp ++The ++.Dv MAGIC_PARAM_INDIR_RECURSION ++parameter controls how many levels of recursion will be followed for ++indirect magic entries. ++.Pp ++The ++.Dv MAGIC_PARAM_NAME_RECURSION ++parameter controls how many levels of recursion will be followed for ++for name/use calls. ++.Pp ++The ++.Dv MAGIC_PARAM_NAME_MAX ++parameter controls the maximum number of calls for name/use. ++.Pp ++The ++.Dv MAGIC_PARAM_NOTES_MAX ++parameter controls how many ELF notes will be processed. ++.Pp ++The ++.Dv MAGIC_PARAM_PHNUM_MAX ++parameter controls how many ELF program sections will be processed. ++.Pp ++The ++.Dv MAGIC_PARAM_SHNUM_MAX ++parameter controls how many ELF sections will be processed. ++.Pp ++The + .Fn magic_version + command returns the version number of this library which is compiled into + the shared library using the constant +Index: contrib/file/doc/magic.man +=================================================================== +--- contrib/file/doc/magic.man (revision 284174) ++++ contrib/file/doc/magic.man (working copy) +@@ -1,5 +1,5 @@ +-.\" $File: magic.man,v 1.84 2014/06/03 19:01:34 christos Exp $ +-.Dd June 3, 2014 ++.\" $File: magic.man,v 1.85 2015/01/01 17:07:34 christos Exp $ ++.Dd January 1, 2015 *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506162107.t5GL7rw0000561>