From e8085628fc65fbe7c5ec30a3d0a2888aed56f16f Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 20 Mar 2008 08:33:20 +0000 Subject: [PATCH] Fix mtx-changer.in for broken Debian mt program. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6643 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/scripts/mtx-changer.in | 14 ++++++++++---- bacula/src/win32/compat/compat.cpp | 30 +++++++++++++++++++----------- bacula/technotes-2.3 | 22 ++++++++++++++++++++++ 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/bacula/scripts/mtx-changer.in b/bacula/scripts/mtx-changer.in index 60630a5531..67a7d5daaf 100644 --- a/bacula/scripts/mtx-changer.in +++ b/bacula/scripts/mtx-changer.in @@ -52,19 +52,25 @@ MTX=@MTX@ # SunOS No Additional Sense # FreeBSD Current Driver State: at rest. # Linux ONLINE +# Note Debian has messed up their mt. When no tape is in the +# drive it waits 2 minutes. When a tape is in the drive, it +# prints user unfriendly output. +# OS=`uname` case ${OS} in SunOS) ready="No Additional Sense" - # Sun sed/awk etc are not sufficient, working versions are in /usr/xpg4/bin - export PATH="/usr/local/sbin:/usr/local/bin:/usr/sfw/bin:/usr/xpg4/bin:/usr/bin" ;; FreeBSD) ready="Current Driver State: at rest." ;; - *) - ready="ONLINE" + Linux) + if test -e /etc/debian_version ; then + ready="drive status" + else + ready="ONLINE" + fi ;; esac diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index 6bee4d1412..a3af259e96 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -624,12 +624,13 @@ statDir(const char *file, struct stat *sb) WIN32_FIND_DATAA info_a; // window's file info // cache some common vars to make code more transparent - DWORD* pdwFileAttributes; - DWORD* pnFileSizeHigh; - DWORD* pnFileSizeLow; - FILETIME* pftLastAccessTime; - FILETIME* pftLastWriteTime; - FILETIME* pftCreationTime; + DWORD *pdwFileAttributes; + DWORD *pnFileSizeHigh; + DWORD *pnFileSizeLow; + DWORD *pdwReserved0; + FILETIME *pftLastAccessTime; + FILETIME *pftLastWriteTime; + FILETIME *pftCreationTime; if (file[1] == ':' && file[2] == 0) { Dmsg1(99, "faking ROOT attrs(%s).\n", file); @@ -652,6 +653,7 @@ statDir(const char *file, struct stat *sb) free_pool_memory(pwszBuf); pdwFileAttributes = &info_w.dwFileAttributes; + pdwReserved0 = &info_w.dwReserved0; pnFileSizeHigh = &info_w.nFileSizeHigh; pnFileSizeLow = &info_w.nFileSizeLow; pftLastAccessTime = &info_w.ftLastAccessTime; @@ -663,6 +665,7 @@ statDir(const char *file, struct stat *sb) h = p_FindFirstFileA(file, &info_a); pdwFileAttributes = &info_a.dwFileAttributes; + pdwReserved0 = &info_a.dwReserved0; pnFileSizeHigh = &info_a.nFileSizeHigh; pnFileSizeLow = &info_a.nFileSizeLow; pftLastAccessTime = &info_a.ftLastAccessTime; @@ -689,7 +692,9 @@ statDir(const char *file, struct stat *sb) /* Use st_rdev to store reparse attribute */ sb->st_rdev = (*pdwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) ? 1 : 0; - + if (sb->st_rdev == 1 && *pdwReserved0 & IO_REPARSE_TAG_MOUNT_POINT) { + sb->st_rdev = 2; /* mount point */ + } sb->st_size = *pnFileSizeHigh; sb->st_size <<= 32; @@ -780,10 +785,6 @@ stat2(const char *file, struct stat *sb) return -1; } - if (attr & FILE_ATTRIBUTE_DIRECTORY) { - return statDir(tmpbuf, sb); - } - h = CreateFileA(tmpbuf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); @@ -798,6 +799,10 @@ stat2(const char *file, struct stat *sb) rval = fstat((int)h, sb); CloseHandle(h); + if (attr & FILE_ATTRIBUTE_DIRECTORY) { + return statDir(tmpbuf, sb); + } + return rval; } @@ -864,6 +869,9 @@ stat(const char *file, struct stat *sb) sb->st_atime = cvt_ftime_to_utime(data.ftLastAccessTime); sb->st_mtime = cvt_ftime_to_utime(data.ftLastWriteTime); sb->st_ctime = cvt_ftime_to_utime(data.ftCreationTime); + if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + return statDir(file, sb); + } return 0; } diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 19140e3a15..2500be4d73 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,28 @@ Technical notes on version 2.3 +New features (buried): +TLS authentication +bextract Win32 data +Run afterVSS +Multiple command/console per runscript +console command +Bat API +Plugin API +State file updated on job term +PluginOptions +FD Version +Duplicate Job directives +MaxFullInterval +MaxDiffInterval +Honor nodump flag +Improved status commands for Bat +Spooling/despooling status +Implement ftruncate for NFS devices + + General: +20Mar08 +kes Fix mtx-changer.in for broken Debian mt program. 19Mar08 kes Fix large number of JobMedia records reported by Eric Bollengier. 18Mar08 -- 2.39.5