Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jul 2009 21:02:26 GMT
From:      Guy Brand <gb@unistra.fr>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/137105: sysutils/freebsd-snapshot not handling non C LANG/LC_ALL
Message-ID:  <200907242102.n6OL2Qw8013586@www.freebsd.org>
Resent-Message-ID: <200907242110.n6OLA8vY036801@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         137105
>Category:       ports
>Synopsis:       sysutils/freebsd-snapshot not handling non C LANG/LC_ALL
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 24 21:10:07 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Guy Brand
>Release:        FreeBSD 8.0-BETA2
>Organization:
University of Strasbourg
>Environment:
FreeBSD 6nq.u-strasbg.fr 8.0-BETA2 FreeBSD 8.0-BETA2 #16: Sun Jul 19 15:24:39 CEST 2009     root@localhost:/usr/obj/usr/src/sys/LENOVO  amd64

>Description:
snapshot (from sysutils/freebsd-snapshot) doesn't handle properly LANG/LC_ALL settings and included awk calculations on filesystems (and snapshots) fail.


>How-To-Repeat:
# LC_ALL=fr_FR.ISO8859-15 snapshot list /var
Filesystem          User   User%     Snap   Snap%  Snapshot       
/usr/local/sbin/snapshot: arith: syntax error: "3,17 * 1024"

>Fix:
A simple fix is to force LANG/LC_ALL to C:

# LC_ALL=C snapshot list /var       
Filesystem          User   User%     Snap   Snap%  Snapshot       
/var               845MB    3.1%      3MB    0.0%  daily.1        
/var               845MB    3.1%      2MB    0.0%  daily.0        
/var               845MB    3.1%    762KB    0.0%  hourly.3       
/var               845MB    3.1%    520KB    0.0%  hourly.2       
/var               845MB    3.1%    388KB    0.0%  hourly.1       
/var               845MB    3.1%    372KB    0.0%  hourly.0       

Updated port attached.

Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	.
#	./distinfo
#	./pkg-descr
#	./Makefile
#	./files
#	./files/patch-snapshot.8
#	./files/patch-snapshot
#	./files/patch-periodic-snapshot
#	./files/pkg-message.in
#	./files/patch-amd.map.snap
#	./files/pkg-deinstall.in
#
echo c - .
mkdir -p . > /dev/null 2>&1
echo x - ./distinfo
sed 's/^X//' >./distinfo << 'aec8793adfd5b7c3f00e62ae41a09ac2'
XMD5 (freebsd-snapshot-20081212.1.tar.gz) = d3e3e6510549339ee38768328d281a49
XSHA256 (freebsd-snapshot-20081212.1.tar.gz) = 33b84b979af4bd2756dc0e91a7a6efd69b354373dc8b5d2f87ee2d2691bd7843
XSIZE (freebsd-snapshot-20081212.1.tar.gz) = 19431
aec8793adfd5b7c3f00e62ae41a09ac2
echo x - ./pkg-descr
sed 's/^X//' >./pkg-descr << '0e313719ff012ceaf97a028d51caa8f5'
Xfreebsd-snapshot is a set of convenience frontend tools to mount(8)
Xand mdconfig(8) for the management of UFS2 snapshots.  It is
Xalso the under-lying tool used in the periodic snapshot
Xscheduler periodic-snapshot(8) and the mounting/unmouning
Xcommand in the amd(8) map /usr/local/etc/amd.map.snap. It
Xprovides the making, expiring, visiting, mounting and
Xunmounting of filesystem snapshots.
X
XAuthor:	Graham Todd <gtodd@bellanet.org>
XWWW:	http://people.freebsd.org/~rse/snapshot/
0e313719ff012ceaf97a028d51caa8f5
echo x - ./Makefile
sed 's/^X//' >./Makefile << '464ef7c6571951809b23e262cbe26e19'
X# New ports collection makefile for:	freebsd-snapshot
X# Date created:				2005-09-07
X# Whom:					gtodd@bellanet.org
X#
X# $FreeBSD: ports/sysutils/freebsd-snapshot/Makefile,v 1.8 2009/01/31 02:43:02 wxs Exp $
X#
X
XPORTNAME=	freebsd-snapshot
XPORTREVISION?=  1
XDISTVERSION=	20081212.1
XCATEGORIES=	sysutils
XMASTER_SITES=	http://people.freebsd.org/~rse/dist/
X
XMAINTAINER=	gtodd@bellanet.org
XCOMMENT=	Convenience frontend tools for the management of UFS2 snapshots
X
XNO_BUILD=	yes
X
XMAN8=		snapshot.8 periodic-snapshot.8
X
XPLIST_FILES=	sbin/snapshot \
X		sbin/periodic-snapshot \
X		etc/amd.map.snap
X
XSUB_FILES=	pkg-message pkg-deinstall
XPKGMESSAGE=	${WRKDIR}/pkg-message
XPKGDEINSTALLL=	${WRKDIR}/pkg-deinstall
X
Xpost-patch:
X	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" \
X		${WRKSRC}/amd.map.snap ${WRKSRC}/snapshot \
X		${WRKSRC}/periodic-snapshot ${WRKSRC}/snapshot.8
X
Xdo-install:
X	${INSTALL_SCRIPT} ${WRKSRC}/snapshot ${PREFIX}/sbin/
X	${INSTALL_SCRIPT} ${WRKSRC}/periodic-snapshot ${PREFIX}/sbin/
X	${INSTALL_MAN} ${WRKSRC}/snapshot.8 ${PREFIX}/man/man8/
X	${INSTALL_MAN} ${WRKSRC}/periodic-snapshot.8 ${PREFIX}/man/man8/
X	${INSTALL_DATA} ${WRKSRC}/amd.map.snap ${PREFIX}/etc/
X
Xpost-install:
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.mk>
464ef7c6571951809b23e262cbe26e19
echo c - ./files
mkdir -p ./files > /dev/null 2>&1
echo x - ./files/patch-snapshot.8
sed 's/^X//' >./files/patch-snapshot.8 << '98258863df3a5b165ad2f5b823ad9799'
X--- snapshot.8.orig	Thu Sep  8 21:28:06 2005
X+++ snapshot.8	Thu Sep  8 21:29:26 2005
X@@ -219,12 +219,12 @@
X By using an
X .Xr amd 8
X map
X-.Pa /etc/amd.map.snap
X+.Pa %%PREFIX%%/etc/amd.map.snap
X containing
X .Bd -literal -offset indent
X /defaults type:=program
X-*         mount:="/usr/sbin/snapshot snapshot mount /${key} ${fs}";\\
X-          unmount:="/usr/sbin/snapshot snapshot umount ${fs}"
X+*         mount:="%%PREFIX%%/sbin/snapshot snapshot mount /${key} ${fs}";\\
X+          unmount:="%%PREFIX%%/sbin/snapshot snapshot umount ${fs}"
X .Ed
X .Pp
X and a
X@@ -232,7 +232,7 @@
X configuration of
X .Bd -literal -offset indent
X amd_enable="YES"
X-amd_flags="-a /.am -c 1800 -w 60 -l syslog /snap /etc/amd.map.snap"
X+amd_flags="-a /.am -c 1800 -w 60 -l syslog /snap %%PREFIX%%/etc/amd.map.snap"
X .Ed
X .Pp
X even non-privileged users can access arbitrary snapshots
98258863df3a5b165ad2f5b823ad9799
echo x - ./files/patch-snapshot
sed 's/^X//' >./files/patch-snapshot << 'c185dbf1b93cef205f2cfb8b166fe309'
X--- snapshot~    2008-12-06 19:37:53.598862157 -0600
X+++ snapshot    2008-12-06 19:37:53.599877379 -0600
X@@ -29,7 +29,9 @@
X ##
X 
X #   make sure system tools are used first
X-PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
X+PATH="/bin:/usr/bin:/sbin:/usr/sbin:%%PREFIX%%/sbin:$PATH"
X+LC_ALL=C
X+LANG=C
X 
X #   option defaults
X verbose=no
X@@ -286,7 +288,7 @@
X         i=19
X         k=`expr $maxgen - 1`
X         while [ $i -gt $k ]; do
X-            if zfs list "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
X+            if zfs list -t snapshot "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
X                 system zfs destroy "$fs_name@$fs_tag.$i"
X             fi
X             i=`expr $i - 1`
X@@ -295,12 +297,12 @@
X         if [ $maxgen -gt 0 ]; then
X             #   rotate remaining snapshots
X             i=$k
X-            if zfs list "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
X+            if zfs list -t snapshot "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
X                 system zfs destroy "$fs_name@$fs_tag.$i"
X             fi
X             i=`expr $i - 1`
X             while [ $i -ge $fs_gen ]; do
X-                if zfs list "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
X+                if zfs list -t snapshot "$fs_name@$fs_tag.$i" >/dev/null 2>&1; then
X                     j=`expr $i + 1`
X                     system zfs rename "$fs_name@$fs_tag.$i" "$fs_name@$fs_tag.$j"
X                 fi
c185dbf1b93cef205f2cfb8b166fe309
echo x - ./files/patch-periodic-snapshot
sed 's/^X//' >./files/patch-periodic-snapshot << '98c23d9163f5bd4d4c9220341c9198b1'
X--- periodic-snapshot.orig      Thu Sep 15 17:44:57 2005
X+++ periodic-snapshot   Thu Sep 15 17:46:31 2005
X@@ -29,7 +29,7 @@
X ##
X
X #   make sure system tools are used first
X-PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
X+PATH="/bin:/usr/bin:/sbin:/usr/sbin:%%PREFIX%%/sbin:$PATH"
X
X #   configuration defaults
X snapshot_enable="NO"
98c23d9163f5bd4d4c9220341c9198b1
echo x - ./files/pkg-message.in
sed 's/^X//' >./files/pkg-message.in << 'f63be51668f70461c30a5539f7c148ef'
X
XUsing periodic for flexible snapshot backup creation
X----------------------------------------------------
X
XEdit your crontab and include this:
X
X# Perform hourly/daily/weekly maintenance (FreeBSD UFS2/ZFS snapshots only).
X0	*	*	*	*	root	%%PREFIX%%/sbin/periodic-snapshot hourly
X0	0	*	*	*	root	%%PREFIX%%/sbin/periodic-snapshot daily
X0	0	*	*	0	root	%%PREFIX%%/sbin/periodic-snapshot weekly
X
Xand edit your periodic.conf and include this:
X
X# UFS2/ZFS Snapshot Creation
Xsnapshot_enable="YES"
Xsnapshot_schedule="/,/usr:2:1:0 /var:0:2:4 /home:2:6:8@8,12,16,20"
X
X----
X
XUsing auto-mount for easy access to snapshot data
X--------------------------------------------------
X
XEdit your rc.conf and include this:
X
X# UFS2/ZFS Snapshot Access
Xamd_enable="YES"
Xamd_flags="-a /.am -c 1800 -w 60 -l syslog /snap %%PREFIX%%/etc/amd.map.snap"
f63be51668f70461c30a5539f7c148ef
echo x - ./files/patch-amd.map.snap
sed 's/^X//' >./files/patch-amd.map.snap << 'be16c566823169316cedadea3053ac5d'
X--- amd.map.snap.orig	Wed Sep  7 23:13:55 2005
X+++ amd.map.snap	Wed Sep  7 23:14:14 2005
X@@ -3,6 +3,6 @@
X #
X 
X /defaults type:=program
X-*         mount:="/usr/sbin/snapshot snapshot mount /${key} ${fs}";\
X-          unmount:="/usr/sbin/snapshot snapshot umount ${fs}"
X+*         mount:="%%PREFIX%%/sbin/snapshot snapshot mount /${key} ${fs}";\
X+          unmount:="%%PREFIX%%/sbin/snapshot snapshot umount ${fs}"
X 
be16c566823169316cedadea3053ac5d
echo x - ./files/pkg-deinstall.in
sed 's/^X//' >./files/pkg-deinstall.in << '545036d76ae9b0ad9cb7c80585eb12a3'
X#!/bin/sh
X#
X# $FreeBSD: ports/sysutils/freebsd-snapshot/files/pkg-deinstall.in,v 1.1 2005/09/23 20:16:31 mnag Exp $
X#
X
Xcase $2 in
X	POST-DEINSTALL)
X		echo "If you completly remove this port, do not forget"
X		echo "then remove lines included by you in:"
X		echo ""
X		echo "crontab"
X		echo "periodic.conf"
X		echo "rc.conf"
X		echo ""
X		;;
Xesac
545036d76ae9b0ad9cb7c80585eb12a3
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907242102.n6OL2Qw8013586>