]> git.sur5r.net Git - bacula/bacula/commitdiff
- Use different share mode when opening files on WinMe/98/95 since
authorKern Sibbald <kern@sibbald.com>
Sat, 2 Oct 2004 10:19:09 +0000 (10:19 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 2 Oct 2004 10:19:09 +0000 (10:19 +0000)
  SHARE_DELETE is not implemented on those systems.
- In new syntax Includes, pass *all* files through the acceptance
  filter so that no error messages will be printed for files that
  cannot be opened if they are excluded.
- Fix bug 126 (Martin) -- prevent failed console label request from
  going into fixup code and thus trying to update the catalog.
- Always fold case in fnmatch() on Win32 systems
- Create patches/README and the patch summary file.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1625 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/examples/next_tape.sh [new file with mode: 0644]
bacula/kernstodo
bacula/patches/README [new file with mode: 0644]
bacula/src/findlib/bfile.c
bacula/src/findlib/find.c
bacula/src/findlib/match.c
bacula/src/stored/block.c
bacula/src/version.h

diff --git a/bacula/examples/next_tape.sh b/bacula/examples/next_tape.sh
new file mode 100644 (file)
index 0000000..d09f44a
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+# A script which kicks out messages if a new tape is required for the next job. 
+# It may be used as RunAfterJob script and it works fine for me. 
+# Maybe someone considers it useful or has some ideas to improve it.
+#
+# Contributed by Dirk grosse Osterhues <digo@rbg.informatik.tu-darmstadt.de>
+#
+# select language: english (en) or german (de)
+LANG="en"
+# reciepient-address for notification
+MAILTO_ADDR="your-email-address"
+# bcc-address for notification
+BCC_ADDR="email-address"
+# directory for temp-files
+TEMP_DIR="/tmp/bacula"
+# bacula's console.conf
+CONSOLE_CONF=/etc/bacula/bconsole.conf
+############################################
+
+# test if console.conf exists
+if [ ! -f $CONSOLE_CONF ]; then
+        echo "You need to reconfigure varible \$CONSOLE_CONF"
+        exit 1
+fi
+# get todays tape
+director_output() {
+/usr/sbin/bacula-console -c $CONSOLE_CONF <<EOF
+status dir
+quit
+EOF
+}
+TODAY=`date +%d.%m.%y`
+YESTERDAY=`date +%d.%m.%y -d yesterday`
+HOST=`hostname -f`
+
+# /root/NEXT-TAPE-$TODAY will be /root/NEXT-TAPE-$YESTERDAY tomorrow ;)
+TAPE_TODAY=`director_output|awk '/^Scheduled Jobs/ { getline; getline; getline; print $6;exit }'`
+
+# did it alreadly run for at least one time?
+if test -f $TEMP_DIR/NEXT-TAPE-$YESTERDAY ; then
+        TAPE_YESTERDAY=`cat $TEMP_DIR/NEXT-TAPE-"$YESTERDAY"`
+else
+        TAPE_YESTERDAY=$TAPE_TODAY
+        echo $TAPE_YESTERDAY>$TEMP_DIR/NEXT-TAPE-$YESTERDAY
+fi
+echo $TAPE_TODAY>$TEMP_DIR/NEXT-TAPE-$TODAY
+
+# definition of language-dependent variables
+case $LANG in
+        de)
+        MAIL_SUBJECT="[Bacula] Bitte Tape wechslen!"
+        MAIL_BODY="Nachricht von Bacula-Backup-System auf $HOST:\
+                \n\n Tape entfernen:\t\""$TAPE_YESTERDAY"\"\
+                \n Tape einlegen: \t\""$TAPE_TODAY"\""
+        ;;
+        en)
+        MAIL_SUBJECT="[Bacula] Please replace Tape tonight!"
+        MAIL_BODY="Message from bacula-backup-service on $HOST:\
+                \n\n Remove Tape:\t\""$TAPE_YESTERDAY"\"\
+                \n Insert Tape:\t\""$TAPE_TODAY"\""
+        ;;
+esac
+
+# send notification
+if [ $TAPE_TODAY != $TAPE_YESTERDAY ] ; then
+        echo -e $MAIL_BODY | mail -a "X-Bacula: Tape-Notifier on $HOST" -s "`echo $MAIL_SUBJECT`" -b $BCC_ADDR $MAILTO_ADDR
+fi
+
+# remove older temp-files
+find $TEMP_DIR -type f -name NEXT-TAPE-\*| while read I; do
+        TAPE_FILE=${I##/tmp/bacula/}
+        if [ $TAPE_FILE ]; then
+                if [ $TAPE_FILE != NEXT-TAPE-$TODAY ] && [ $TAPE_FILE != NEXT-TAPE-$YESTERDAY ]; then
+                        rm  $TEMP_DIR/$TAPE_FILE
+                fi
+        fi
+done
index 2374bb5ed7c2b623c572f742ffde98eae3ed948a..353dcb9578c2f548eaa7f918c4d480e4501bef30 100644 (file)
@@ -69,6 +69,8 @@ Testing to do: (painful)
 
 
 For 1.37 Testing/Documentation:
+- Implement a Client filename case fold option (default = fold
+  on Win32).
 - Fix list volumes to output volume retention in some other
   units, perhaps via a directive.
 - If opening a tape in read/write mode fails attempt to open
diff --git a/bacula/patches/README b/bacula/patches/README
new file mode 100644 (file)
index 0000000..910d6ed
--- /dev/null
@@ -0,0 +1,18 @@
+
+This directory contains patches to the *previous* released version
+of Bacula. As they are developed, they will be put into this directory
+so that they are all in one place, and you can easily find all
+the patches that exist at a particular time.
+
+When a new official version of Bacula is released (for example 1.36.0),
+the patches for the previous release (for example 1.34) will be 
+placed in a subdirectory, and patches for the new version will
+go into the main directory.
+
+The file "patches-version" (for example "patches-1.34.6") will 
+contain a summary of each of the patches and when it was created,
+so that you can easily see the order and the purpose of each patch.
+Sometimes there may be dependencies between the patches -- i.e. a 
+later patch needs a prior patch to be applied first. I'll try to
+note those, but cannot guarantee it.
+
index 9197233da368f8fca3b315ffe32759652e8ca1b4..1f9122a070cb948dc4eba6f546bb673a72bc778e 100644 (file)
@@ -9,7 +9,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2003-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -192,7 +192,7 @@ HANDLE bget_handle(BFILE *bfd)
 int bopen(BFILE *bfd, const char *fname, int flags, mode_t mode)
 {
    POOLMEM *win32_fname;
-   DWORD dwaccess, dwflags;
+   DWORD dwaccess, dwflags, dwshare;
 
    /* Convert to Windows path format */
    win32_fname = get_pool_memory(PM_FNAME);
@@ -217,11 +217,7 @@ int bopen(BFILE *bfd, const char *fname, int flags, mode_t mode)
 
    } else if (flags & O_WRONLY) {     /* Open existing for write */
       if (bfd->use_backup_api) {
-#ifdef HAVE_WIN32
-         dwaccess = GENERIC_WRITE|/*FILE_ALL_ACCESS|*/WRITE_OWNER|WRITE_DAC/*|ACCESS_SYSTEM_SECURITY*/;
-#else
-         dwaccess = GENERIC_WRITE|FILE_ALL_ACCESS|WRITE_OWNER|WRITE_DAC|ACCESS_SYSTEM_SECURITY;
-#endif
+        dwaccess = GENERIC_WRITE|WRITE_OWNER|WRITE_DAC;
         dwflags = FILE_FLAG_BACKUP_SEMANTICS;
       } else {
         dwaccess = GENERIC_WRITE;
@@ -240,13 +236,15 @@ int bopen(BFILE *bfd, const char *fname, int flags, mode_t mode)
       if (bfd->use_backup_api) {
         dwaccess = GENERIC_READ|READ_CONTROL|ACCESS_SYSTEM_SECURITY;
         dwflags = FILE_FLAG_BACKUP_SEMANTICS;
+        dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE;
       } else {
         dwaccess = GENERIC_READ;
         dwflags = 0;
+        dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE;
       }
       bfd->fh = CreateFile(win32_fname,
             dwaccess,                /* Requested access */
-            FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+            dwshare,                 /* Share modes */
             NULL,                    /* SecurityAttributes */
             OPEN_EXISTING,           /* CreationDisposition */
             dwflags,                 /* Flags and attributes */
index 4180319cf625c3ee28ba3678b91b322fcecb24a9..c8a510f6d8c6f3c9ae2103969b755f91b65f163c 100644 (file)
@@ -1,6 +1,9 @@
 /*
  * Main routine for finding files on a file system.
- *  The heart of the work is done in find_one.c
+ *  The heart of the work to find the files on the
+ *    system is done in find_one.c. Here we have the
+ *    higher level control as well as the matching
+ *    routines for the new syntax Options resource.
  *
  *  Kern E. Sibbald, MM
  */
@@ -38,6 +41,13 @@ int32_t path_max;           /* path name max length */
 static int our_callback(FF_PKT *ff, void *hpkt);
 static bool accept_file(FF_PKT *ff);
 
+/* Fold case in fnmatch() on Win32 */
+#ifdef WIN32
+static const int fnmode = FNM_CASEFOLD;
+#else
+static const int fnmode = 0;
+#endif
+
 
 /* 
  * Initialize the find files "global" variables
@@ -165,7 +175,7 @@ static bool accept_file(FF_PKT *ff)
       ff->reader = fo->reader;
       ff->writer = fo->writer;
       for (k=0; k<fo->wild.size(); k++) {
-        if (fnmatch((char *)fo->wild.get(k), ff->fname, 0) == 0) {
+        if (fnmatch((char *)fo->wild.get(k), ff->fname, fnmode) == 0) {
            if (ff->flags & FO_EXCLUDE) {
               return false;          /* reject file */
            }
@@ -191,14 +201,14 @@ static bool accept_file(FF_PKT *ff)
       for (j=0; j<incexe->opts_list.size(); j++) {
         findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j);
         for (k=0; k<fo->wild.size(); k++) {
-           if (fnmatch((char *)fo->wild.get(k), ff->fname, 0) == 0) {
+           if (fnmatch((char *)fo->wild.get(k), ff->fname, fnmode) == 0) {
                Dmsg1(400, "Reject wild1: %s\n", ff->fname);
               return false;          /* reject file */
            }
         }
       }
       for (j=0; j<incexe->name_list.size(); j++) {
-        if (fnmatch((char *)incexe->name_list.get(j), ff->fname, 0) == 0) {
+        if (fnmatch((char *)incexe->name_list.get(j), ff->fname, fnmode) == 0) {
             Dmsg1(400, "Reject wild2: %s\n", ff->fname);
            return false;          /* reject file */
         }
@@ -223,7 +233,7 @@ static int our_callback(FF_PKT *ff, void *hpkt)
    case FT_NORECURSE:
    case FT_NOFSCHG:
    case FT_NOOPEN:
-      return ff->callback(ff, hpkt);
+//    return ff->callback(ff, hpkt);
 
    /* These items can be filtered */
    case FT_LNKSAVED:
index 43a27a2b5300cdd7b462e146c826b1babfa8c068..a1b811418daf8ba1c644b7ad5f11c15e72b47553 100644 (file)
@@ -2,6 +2,10 @@
  *  Routines used to keep and match include and exclude
  *   filename/pathname patterns.
  *
+ *  Note, this file is used for the old style include and
+ *   excludes, so is deprecated. The new style code is 
+ *   found in find.c
+ *
  *   Kern E. Sibbald, December MMI
  *
  */
 #define FNM_LEADING_DIR 0
 #endif
 
+/* Fold case in fnmatch() on Win32 */
+#ifdef WIN32
+static const int fnmode = FNM_CASEFOLD;
+#else
+static const int fnmode = 0;
+#endif
+
+
 #undef bmalloc
 #define bmalloc(x) sm_malloc(__FILE__, __LINE__, x)
 
@@ -279,7 +291,7 @@ int file_is_included(FF_PKT *ff, const char *file)
 
    for ( ; inc; inc=inc->next ) {
       if (inc->pattern) {
-        if (fnmatch(inc->fname, file, FNM_LEADING_DIR) == 0) {
+        if (fnmatch(inc->fname, file, fnmode|FNM_LEADING_DIR) == 0) {
            return 1;
         }
         continue;
@@ -316,7 +328,7 @@ file_in_excluded_list(struct s_excluded_file *exc, const char *file)
       Dmsg0(900, "exc is NULL\n");
    }
    for ( ; exc; exc=exc->next ) {
-      if (fnmatch(exc->fname, file, FNM_PATHNAME) == 0) {
+      if (fnmatch(exc->fname, file, fnmode|FNM_PATHNAME) == 0) {
          Dmsg2(900, "Match exc pat=%s: file=%s:\n", exc->fname, file);
         return 1;
       }
index 1c73dc47d536724f641ba879dde59cff436b7dfd..d7288b0126852f522acde0fe15bae0b4fda5e2f6 100644 (file)
@@ -366,7 +366,7 @@ bool write_block_to_device(DCR *dcr)
    }
 
    if (!write_block_to_dev(dcr)) {
-       if (job_canceled(jcr)) {
+       if (job_canceled(jcr) || jcr->JobType == JT_SYSTEM) {
          stat = false;
        } else {
          stat = fixup_device_block_write_error(dcr);
index 95bcb0d1c0572583836a828778b3bf32d3aec345..f499ef9438871d69ecad9792a4b4df764fab9440 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
 #define VERSION "1.35.6"
-#define BDATE   "30 September 2004"
-#define LSMDATE "30Sep04"
+#define BDATE   "02 October 2004"
+#define LSMDATE "02Oct04"
 
 /* Debug flags */
 #undef  DEBUG