pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/34038: dump takes modulo 10 dump level
>Number: 34038
>Category: pkg
>Synopsis: dump takes modulo 10 dump level
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Jul 19 17:05:01 +0000 2006
>Originator: Matthew Vincenz
>Release: 3
>Organization:
UofC
>Environment:
>Description:
hi, I submitted a patch for this to the gnu folks a couple years ago. it would
be nice to have the same functionality on our bsd boxes. patch is here if
formatting is screwed up below:
http://www.lib.uchicago.edu/~msv/openbsddiff
tested and appears to work
thanks
Matthew
>How-To-Repeat:
>Fix:
--- itime.c.1.16 2006-07-19 10:03:49.000000000 -0500
+++ itime.c 2006-07-19 10:14:14.000000000 -0500
@@ -136,11 +136,11 @@
fname = disk;
#ifdef FDEBUG
- msg("Looking for name %s in dumpdates = %s for level = %c\n",
+ msg("Looking for name %s in dumpdates = %s for level = %s\n",
fname, dumpdates, level);
#endif
spcl.c_ddate = 0;
- lastlevel = '0';
+ memset(&lastlevel,0,NUM_STR_SIZE);
initdumptimes();
/*
@@ -150,12 +150,12 @@
ITITERATE(i, ddp) {
if (strncmp(fname, ddp->dd_name, sizeof (ddp->dd_name)) != 0)
continue;
- if (ddp->dd_level >= level)
+ if (ddp->dd_level >= atoi(level))
continue;
if (ddp->dd_ddate <= iswap32(spcl.c_ddate))
continue;
spcl.c_ddate = iswap32(ddp->dd_ddate);
- lastlevel = ddp->dd_level;
+ snprintf(lastlevel,NUM_STR_SIZE,"%d",ddp->dd_level);
}
}
@@ -186,7 +186,7 @@
if (strncmp(fname, dtwalk->dd_name,
sizeof (dtwalk->dd_name)) != 0)
continue;
- if (dtwalk->dd_level != level)
+ if (dtwalk->dd_level != atoi(level))
continue;
goto found;
}
@@ -199,7 +199,7 @@
nddates += 1;
found:
(void) strlcpy(dtwalk->dd_name, fname, sizeof(dtwalk->dd_name));
- dtwalk->dd_level = level;
+ dtwalk->dd_level = atoi(level);
dtwalk->dd_ddate = iswap32(spcl.c_date);
dtfound = dtwalk;
@@ -211,7 +211,7 @@
if (ftruncate(fd, ftell(df)))
quit("ftruncate (%s): %s\n", dumpdates, strerror(errno));
(void) fclose(df);
- msg("level %c dump on %s", level,
+ msg("level %s dump on %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime(&dtfound->dd_ddate));
}
@@ -242,7 +242,7 @@
dumpdates, recno);
#ifdef FDEBUG
- msg("getrecord: %s %c %s", ddatep->dd_name, ddatep->dd_level,
+ msg("getrecord: %s %d %s", ddatep->dd_name, ddatep->dd_level,
ddatep->dd_ddate == 0 ? "the epoch\n" : ctime(&ddatep->dd_ddate));
#endif
return(0);
@@ -259,3 +259,4 @@
return(-1);
return(0);
}
+
--- dump.h.1.43 2006-07-19 10:15:50.000000000 -0500
+++ dump.h 2006-07-19 10:22:20.000000000 -0500
@@ -94,6 +94,9 @@
#define TSTINO(ino, map) \
(map[(u_int)((ino) - 1) / NBBY] & (1 << ((u_int)((ino) - 1) % NBBY)))
+
+#define NUM_STR_SIZE 32 /* max length of dump level string */
+
/*
* All calculations done in 0.1" units!
*/
@@ -101,8 +104,8 @@
const char *tape; /* name of the tape file */
const char *dumpdates; /* name of the file containing dump date information*/
const char *temp; /* name of the file for doing rewrite of dumpdates */
-char lastlevel; /* dump level of previous dump */
-char level; /* dump level of this dump */
+char lastlevel[NUM_STR_SIZE]; /* dump level of previous dump */
+char level[NUM_STR_SIZE]; /* dump level of this dump */
int uflag; /* update flag */
int eflag; /* eject flag */
int lflag; /* autoload flag */
@@ -262,7 +265,7 @@
*/
struct dumpdates {
char dd_name[NAME_MAX+3];
- char dd_level;
+ int dd_level;
time_t dd_ddate;
};
--- optr.c.1.35 2006-07-19 10:56:06.000000000 -0500
+++ optr.c 2006-07-19 10:57:49.000000000 -0500
@@ -485,7 +485,7 @@
dtwalk->dd_ddate < tnow - (dt->fs_freq * SECSPERDAY));
if (arg != 'w' || dumpme)
(void) printf(
- "%c %8s\t(%6s) Last dump: Level %c, Date %s\n",
+ "%c %8s\t(%6s) Last dump: Level %d, Date %s\n",
dumpme && (arg != 'w') ? '>' : ' ',
dtwalk->dd_name,
dt ? dt->fs_file : "",
--- main.c.1.62 2006-07-19 10:23:40.000000000 -0500
+++ main.c 2006-07-19 10:51:33.000000000 -0500
@@ -99,7 +99,7 @@
struct fstab *dt;
struct statvfs *mntinfo, fsbuf;
char *map, *cp;
- int ch;
+ int ch, pch = 0;
int i, anydirskipped, bflag = 0, Tflag = 0, Fflag = 0, honorlevel = 1;
int snap_internal = 0;
ino_t maxino;
@@ -126,7 +126,7 @@
strcpy(labelstr, "none"); /* XXX safe strcpy. */
if (TP_BSIZE / DEV_BSIZE == 0 || TP_BSIZE % DEV_BSIZE != 0)
quit("TP_BSIZE must be a multiple of DEV_BSIZE\n");
- level = '0';
+ memset(&level,0,NUM_STR_SIZE);
timestamp = 0;
if (argc < 2)
@@ -139,7 +139,10 @@
/* dump level */
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
- level = ch;
+ if ((pch >= '0') && (pch <= '9') && (strlen(level) <
NUM_STR_SIZE))
+ level[strlen(level)] = ch;
+ else level[0] = ch;
+ pch = ch;
break;
case 'a': /* `auto-size', Write to EOM. */
@@ -234,7 +237,7 @@
exit(X_STARTUP);
}
Tflag = 1;
- lastlevel = '?';
+ sprintf(lastlevel,"?");
break;
case 'u': /* update /etc/dumpdates */
@@ -304,9 +307,9 @@
msg("Ignoring u flag for subdir dump\n");
uflag = 0;
}
- if (level > '0') {
+ if (atoi(level) > 0) {
msg("Subdir dump is done at level 0\n");
- level = '0';
+ memset(&level,0,NUM_STR_SIZE);
}
msg("Dumping sub files/directories from %s\n",
mountpoint);
@@ -461,7 +464,7 @@
needswap = fs_read_sblock(sblock_buf);
- spcl.c_level = iswap32(level - '0');
+ spcl.c_level = iswap32(atoi(level));
spcl.c_type = iswap32(TS_TAPE);
spcl.c_date = iswap32(spcl.c_date);
spcl.c_ddate = iswap32(spcl.c_ddate);
@@ -469,10 +472,10 @@
getdumptime(); /* /etc/dumpdates snarfed */
date = iswap32(spcl.c_date);
- msg("Date of this level %c dump: %s", level,
+ msg("Date of this level %s dump: %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime(&date));
date = iswap32(spcl.c_ddate);
- msg("Date of last level %c dump: %s", lastlevel,
+ msg("Date of last level %s dump: %s", lastlevel,
spcl.c_ddate == 0 ? "the epoch\n" : ctime(&date));
msg("Dumping ");
if (snap_backup != NULL || snap_internal)
@@ -629,7 +632,7 @@
(iswap32(spcl.c_volume) == 1) ? "" : "s");
tnow = do_stats();
date = iswap32(spcl.c_date);
- msg("Date of this level %c dump: %s", level,
+ msg("Date of this level %s dump: %s", level,
spcl.c_date == 0 ? "the epoch\n" : ctime(&date));
msg("Date this dump completed: %s", ctime(&tnow));
msg("Average transfer rate: %d KB/s\n", xferrate / tapeno);
--- /usr/include/protocols/dumprestore.h.1.14 2006-07-19 11:24:47.000000000
-0500
+++ /usr/include/protocols/dumprestore.h 2006-07-19 11:03:04.000000000
-0500
@@ -151,8 +151,8 @@
#define DR_NEWHEADER 0x0001 /* new format tape header */
#define DR_NEWINODEFMT 0x0002 /* new format inodes on tape */
-#define DUMPOUTFMT "%-16s %c %s" /* for printf */
+#define DUMPOUTFMT "%-16s %d %s" /* for printf */
/* name, level, ctime(date) */
-#define DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */
+#define DUMPINFMT "%16s %d %[^\n]\n" /* inverse for scanf */
#endif /* !_PROTOCOLS_DUMPRESTORE_H_ */
Home |
Main Index |
Thread Index |
Old Index