to files written to an alternate directory (i.e. using a where=).
- Certain open files (Word for example) can now be saved on
Win32 systems.
-- Default for Wild-cards on Win32 systems is to fold case.
+- Default for Wild-cards on Win32 systems is to fold case this
+ should correct most of the problems users are having with
+ exclusion on Win32.
New Directives:
- Added "Rerun Failed levels = yes/no" in the Job resource
========================================================
1.35 Items to do for release:
+- Remove documentation for readline.
+- Add File indexes as suggested by Martin -- modify update
+ scripts to add them.
+- Modify postgresql update script to remove bigint FilenameId
+ reference.
+
Maybe for 1.35:
- Add Pool/Storage override regression test.
- Document a get out of jail procedure if everything breaks if
you lost/broke the Catalog -- do the same for "I know my
file is there how do I get it back?".
-
default 0,
jobid integer not null,
pathid integer not null,
- filenameid bigint not null,
+ filenameid integer not null,
markid integer not null
default 0,
lstat text not null,
-extern char *getuser(uid_t uid);
-extern char *getgroup(gid_t gid);
+extern char *getuser(uid_t uid, char *name, int len);
+extern char *getgroup(gid_t gid, char *name, int len);
/*
* This is actually the long form used for "dir"
char *p;
const char *f;
char ec1[30];
+ char en1[30], en2[30];
int n;
p = encode_mode(statp->st_mode, buf);
n = sprintf(p, " %2d ", (uint32_t)statp->st_nlink);
p += n;
- n = sprintf(p, "%-8.8s %-8.8s", getuser(statp->st_uid), getgroup(statp->st_gid));
+ n = sprintf(p, "%-8.8s %-8.8s", getuser(statp->st_uid, en1, sizeof(en1)),
+ getgroup(statp->st_gid, en2, sizeof(en2)));
p += n;
n = sprintf(p, "%8.8s ", edit_uint64(statp->st_size, ec1));
p += n;
jcr->last_fname = get_pool_memory(PM_FNAME);
jcr->last_fname[0] = 0;
jcr->client_name = get_memory(strlen(my_name) + 1);
- pm_strcpy(&jcr->client_name, my_name);
+ pm_strcpy(jcr->client_name, my_name);
dir->jcr = jcr;
enable_backup_privileges(NULL, 1 /* ignore_errors */);
Dmsg1(110, "setdebug_cmd: %s", dir->msg);
if (sscanf(dir->msg, "setdebug=%d trace=%d", &level, &trace_flag) != 2 || level < 0) {
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
bnet_fsend(dir, "2991 Bad setdebug command: %s\n", jcr->errmsg);
return 0;
}
char ed2[50];
if (sscanf(dir->msg, estimatecmd, &jcr->listing) != 1) {
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
Jmsg(jcr, M_FATAL, 0, _("Bad estimate command: %s"), jcr->errmsg);
bnet_fsend(dir, "2992 Bad estimate command.\n");
return 0;
if (sscanf(dir->msg, jobcmd, &jcr->JobId, jcr->Job,
&jcr->VolSessionId, &jcr->VolSessionTime,
sd_auth_key) != 5) {
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
Jmsg(jcr, M_FATAL, 0, _("Bad Job Command: %s"), jcr->errmsg);
bnet_fsend(dir, BADjob);
free_pool_memory(sd_auth_key);
Dmsg1(100, "runbefore_cmd: %s", dir->msg);
if (sscanf(dir->msg, runbefore, cmd) != 1) {
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
Jmsg1(jcr, M_FATAL, 0, _("Bad RunBeforeJob command: %s\n"), jcr->errmsg);
bnet_fsend(dir, "2905 Bad RunBeforeJob command.\n");
free_memory(cmd);
Dmsg1(100, "runafter_cmd: %s", dir->msg);
if (sscanf(dir->msg, runafter, msg) != 1) {
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
Jmsg1(jcr, M_FATAL, 0, _("Bad RunAfter command: %s\n"), jcr->errmsg);
bnet_fsend(dir, "2905 Bad RunAfterJob command.\n");
free_memory(msg);
free_pool_memory(jcr->RunAfterJob);
}
jcr->RunAfterJob = get_pool_memory(PM_FNAME);
- pm_strcpy(&jcr->RunAfterJob, msg);
+ pm_strcpy(jcr->RunAfterJob, msg);
free_pool_memory(msg);
return bnet_fsend(dir, OKRunAfter);
}
return bnet_fsend(dir, OKlevel);
bail_out:
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
Jmsg1(jcr, M_FATAL, 0, _("Bad level command: %s\n"), jcr->errmsg);
free_memory(level);
if (buf) {
&jcr->VolSessionId, &jcr->VolSessionTime,
&jcr->StartFile, &jcr->EndFile,
&jcr->StartBlock, &jcr->EndBlock) != 7) {
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
Jmsg(jcr, M_FATAL, 0, "Bad session command: %s", jcr->errmsg);
return 0;
}
Dmsg1(100, "StorageCmd: %s", dir->msg);
if (sscanf(dir->msg, storaddr, &jcr->stored_addr, &stored_port, &enable_ssl) != 3) {
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
Jmsg(jcr, M_FATAL, 0, _("Bad storage command: %s"), jcr->errmsg);
return 0;
}
if (sscanf(dir->msg, restorecmd, &replace, &prefix_links, where) != 3) {
if (sscanf(dir->msg, restorecmd1, &replace, &prefix_links) != 2) {
- pm_strcpy(&jcr->errmsg, dir->msg);
+ pm_strcpy(jcr->errmsg, dir->msg);
Jmsg(jcr, M_FATAL, 0, _("Bad replace command. CMD=%s\n"), jcr->errmsg);
return 0;
}
set_jcr_job_status(jcr, JS_ErrorTerminated);
goto bail_out;
}
- pm_strcpy(&sd->msg, bootstrap);
- sd->msglen = strlen(sd->msg);
+ sd->msglen = pm_strcpy(sd->msg, bootstrap);
bnet_send(sd);
while (fgets(buf, sizeof(buf), bs)) {
sd->msglen = Mmsg(sd->msg, "%s", buf);
extern char my_name[];
extern int num_jobs_run;
extern time_t daemon_start_time;
+extern bool get_trace(void);
/* Forward referenced functions */
static void list_terminated_jobs(void sendit(const char *msg, int len, void *sarg), void *arg);
edit_uint64_with_commas(sm_max_bytes, b2),
edit_uint64_with_commas(sm_buffers, b3),
edit_uint64_with_commas(sm_max_buffers, b4));
- sendit(msg, len, arg);
- }
- if (debug_level > 0) {
- len = Mmsg(msg, _(" Sizeof: off_t=%d size_t=%d\n"), sizeof(off_t),
- sizeof(size_t));
+ sendit(msg, len, arg);
+ len = Mmsg(msg, _(" Sizeof: off_t=%d size_t=%d debug=%d trace=%d\n"),
+ sizeof(off_t), sizeof(size_t), debug_level, get_trace());
sendit(msg, len, arg);
}
bnet_fsend(dir, OKqstatus, time);
lock_jcr_chain();
foreach_jcr(njcr) {
- if (njcr->JobId != 0) {
- bnet_fsend(dir, DotStatusJob, njcr->JobId, njcr->JobStatus, njcr->JobErrors);
- }
- free_locked_jcr(njcr);
+ if (njcr->JobId != 0) {
+ bnet_fsend(dir, DotStatusJob, njcr->JobId, njcr->JobStatus, njcr->JobErrors);
+ }
+ free_locked_jcr(njcr);
}
unlock_jcr_chain();
}
else if (strcmp(time, "last") == 0) {
bnet_fsend(dir, OKqstatus, time);
if ((last_jobs) && (last_jobs->size() > 0)) {
- job = (s_last_job*)last_jobs->last();
- bnet_fsend(dir, DotStatusJob, job->JobId, job->JobStatus, job->Errors);
+ job = (s_last_job*)last_jobs->last();
+ bnet_fsend(dir, DotStatusJob, job->JobId, job->JobStatus, job->Errors);
}
}
else {
}
}
-extern char *getuser(uid_t uid);
-extern char *getgroup(gid_t gid);
+extern char *getuser(uid_t uid, char *name, int len);
+extern char *getgroup(gid_t gid, char *name, int len);
/*
* Print an ls style message, also send M_RESTORED
{
char buf[5000];
char ec1[30];
+ char en1[30], en2[30];
char *p, *f;
p = encode_mode(attr->statp.st_mode, buf);
p += sprintf(p, " %2d ", (uint32_t)attr->statp.st_nlink);
- p += sprintf(p, "%-8.8s %-8.8s", getuser(attr->statp.st_uid), getgroup(attr->statp.st_gid));
+ p += sprintf(p, "%-8.8s %-8.8s", getuser(attr->statp.st_uid, en1, sizeof(en1)),
+ getgroup(attr->statp.st_gid, en2, sizeof(en2)));
p += sprintf(p, "%8.8s ", edit_uint64(attr->statp.st_size, ec1));
p = encode_time(attr->statp.st_ctime, p);
*p++ = ' ';
* two network packets. The first is sends a 32 bit integer containing
* the length of the data packet which follows.
*
- * Returns: 0 on failure
- * 1 on success
+ * Returns: false on failure
+ * true on success
*/
bool bnet_send(BSOCK * bsock)
{
struct tm *localtime_r(const time_t *timep, struct tm *tm)
{
static pthread_mutex_t mutex;
- static int first = 1;
- struct tm *ltm;
+ static bool first = true;
+ struct tm *ltm,
if (first) {
pthread_mutex_init(&mutex, NULL);
- first = 0;
+ first = false;
}
+
P(mutex);
+
ltm = localtime(timep);
if (ltm) {
memcpy(tm, ltm, sizeof(struct tm));
/* Translate UID to a login name or a stringified number,
with cache. */
-char *getuser(uid_t uid)
+char *getuser(uid_t uid, char *name, int len)
{
register struct userid *tail;
struct passwd *pwent;
P(mutex);
for (tail = user_alist; tail; tail = tail->next) {
if (tail->id.u == uid) {
- V(mutex);
- return tail->name;
+ goto uid_done;
}
}
tail = (struct userid *)malloc(sizeof (struct userid));
tail->id.u = uid;
#ifndef HAVE_WIN32
- if (pwent == 0 || strcmp(pwent->pw_name, "????????") == 0) {
+ if (pwent == NULL || strcmp(pwent->pw_name, "????????") == 0) {
sprintf(usernum_string, "%u", (uint32_t)uid);
tail->name = bstrdup(usernum_string);
} else {
/* Add to the head of the list, so most recently used is first. */
tail->next = user_alist;
user_alist = tail;
+
+uid_done:
+ bstrncpy(name, tail->name, len);
V(mutex);
- return tail->name;
+ return name;
}
void free_getuser_cache()
/* Translate GID to a group name or a stringified number,
with cache. */
-char *getgroup(gid_t gid)
+char *getgroup(gid_t gid, char *name, int len)
{
register struct userid *tail;
struct group *grent;
P(mutex);
for (tail = group_alist; tail; tail = tail->next) {
if (tail->id.g == gid) {
- V(mutex);
- return tail->name;
+ goto gid_done;
}
}
tail = (struct userid *)malloc(sizeof (struct userid));
tail->id.g = gid;
#ifndef HAVE_WIN32
- if (grent == 0 || strcmp(grent->gr_name, "????????") == 0) {
+ if (grent == NULL || strcmp(grent->gr_name, "????????") == 0) {
sprintf (groupnum_string, "%u", (uint32_t)gid);
tail->name = bstrdup(groupnum_string);
} else {
/* Add to the head of the list, so most recently used is first. */
tail->next = group_alist;
group_alist = tail;
+
+gid_done:
+ bstrncpy(name, tail->name, len);
V(mutex);
- return tail->name;
+ return name;
}
void free_getgroup_cache()
}
}
+bool get_trace(void)
+{
+ return trace;
+}
+
/*********************************************************************
*
* This subroutine prints a message regardless of the debug level
}
}
+#ifdef WIN32
+extern long _timezone;
+extern int _daylight;
+extern long _dstbias;
+extern "C" void __tzset(void);
+extern "C" int _isindst(struct tm *);
+#endif
char *encode_time(time_t time, char *buf)
{
struct tm tm;
int n = 0;
+#ifdef WIN32
+ /*
+ * Gross kludge to avoid a seg fault in Microsoft's CRT localtime_r(),
+ * which incorrectly references a NULL returned from gmtime() if
+ * the time (adjusted for the current timezone) is invalid.
+ * This could happen if you have a bad date/time, or perhaps if you
+ * moved a file from one timezone to another?
+ */
+ struct tm *gtm;
+ time_t gtime;
+ __tzset();
+ gtime = time - _timezone;
+ if (!(gtm = gmtime(>ime))) {
+ return buf;
+ }
+ if (_daylight && _isindst(gtm)) {
+ gtime -= _dstbias;
+ if (!gmtime(>ime)) {
+ return buf;
+ }
+ }
+#endif
if (localtime_r(&time, &tm)) {
n = sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
/* */
#undef VERSION
-#define VERSION "1.35.8"
-#define BDATE "08 October 2004"
-#define LSMDATE "08Oct04"
+#define VERSION "1.35.9"
+#define BDATE "12 October 2004"
+#define LSMDATE "12Oct04"
/* Debug flags */
#undef DEBUG
sb->st_ino <<= 32;
sb->st_ino |= info.nFileIndexLow;
sb->st_nlink = (short)info.nNumberOfLinks;
+ if (sb->st_nlink > 1) {
+ d_msg(__FILE__, __LINE__, 99, "st_nlink=%d\n", sb->st_nlink);
+ }
sb->st_mode = 0777; /* start with everything */
if (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
if (h == INVALID_HANDLE_VALUE) {
const char *err = errorString();
d_msg(__FILE__, __LINE__, 99,
- "Cannot open file for utime(%s,...):%s\n", tmpbuf, err);
+ "Cannot open file \"%s\" for utime(): ERR=%s", tmpbuf, err);
LocalFree((void *)err);
errno = b_errno_win32;
return -1;