From 6664812ecac5b5b3748b332d8a3b88b32a17c007 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 21 Dec 2005 12:22:32 +0000 Subject: [PATCH] Remove new bnet_sig git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2697 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kes-1.38 | 14 ++- bacula/kes-1.39 | 13 ++ bacula/platforms/mandrake/bacula.spec.in | 16 +++ bacula/platforms/redhat/bacula.spec.in | 16 +++ bacula/platforms/suse/bacula.spec.in | 16 +++ bacula/src/dird/restore.c | 12 -- bacula/src/dird/ua.h | 16 +-- bacula/src/dird/ua_output.c | 14 +-- bacula/src/dird/ua_select.c | 2 + bacula/src/dird/ua_server.c | 2 +- bacula/src/lib/bnet_pkt.c | 153 ----------------------- bacula/src/lib/bsock.h | 36 +----- bacula/src/lib/bsys.c | 2 +- bacula/src/stored/dev.c | 9 ++ 14 files changed, 102 insertions(+), 219 deletions(-) delete mode 100644 bacula/src/lib/bnet_pkt.c diff --git a/bacula/kes-1.38 b/bacula/kes-1.38 index 4fc228650b..068af6f153 100644 --- a/bacula/kes-1.38 +++ b/bacula/kes-1.38 @@ -3,9 +3,21 @@ General: -Beta release 20Dec05: Changes to 1.38.3: 20Dec05 +- Modify gui on command to set only GUI mode and not batch. +- Modify .messages command to always print messages regardless + of the mode. +- If GUI mode is on, suppress automatic printing of + You have messages. +- Delete old bnet packet code. +- Ignore new BNET_START_SELECT and BNET_END_SELECT signals in + wx-console. +- Modify restore command in wx-console to set gui on and to use + only .messages instead of messages. Hopefully this fixes bug + #514. +Beta release 20Dec05: +20Dec05 - Fix seg fault in exit of acquire when canceling a job -- reported by Wolfgang Denk 19Dec05 diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index 0093df18f3..0584dc246d 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -5,6 +5,19 @@ General: Changes to 1.39.3: 20Dec05 +- Modify gui on command to set only GUI mode and not batch. +- Modify .messages command to always print messages regardless + of the mode. +- If GUI mode is on, suppress automatic printing of + You have messages. +- Delete old bnet packet code. +- Ignore new BNET_START_SELECT and BNET_END_SELECT signals in + wx-console. +- Modify restore command in wx-console to set gui on and to use + only .messages instead of messages. Hopefully this fixes bug + #514. +- Fix seg fault in exit of acquire when canceling a job -- + reported by Wolfgang Denk - Pull in latest reservation system changes from 1.38 - Make .messages command always print messages regardless of the automessages flag. diff --git a/bacula/platforms/mandrake/bacula.spec.in b/bacula/platforms/mandrake/bacula.spec.in index c65223bc09..e0df4a6af1 100644 --- a/bacula/platforms/mandrake/bacula.spec.in +++ b/bacula/platforms/mandrake/bacula.spec.in @@ -529,6 +529,17 @@ export LDFLAGS=-L/usr/lib64 export LDFLAGS=-L/usr/lib64/mysql %endif +%configure \ + --prefix=/usr \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc/bacula \ + --with-scriptdir=/etc/bacula \ + --enable-smartalloc \ + --enable-client-only \ + --enable-static-fd + +make + %configure \ --prefix=/usr \ --sbindir=/usr/sbin \ @@ -624,6 +635,8 @@ rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql %endif +rm -f $RPM_BUILD_ROOT/usr/sbin/static-bacula-fd + # install the init scripts %if %{su9} cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir @@ -695,6 +708,9 @@ cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT/etc/bacula/rescue/ +touch $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/rpm_release +cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/bacula/bin/bacula-fd +rm -f src/filed/static-bacula-fd # now clean up permissions that are left broken by the install chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql diff --git a/bacula/platforms/redhat/bacula.spec.in b/bacula/platforms/redhat/bacula.spec.in index c65223bc09..e0df4a6af1 100644 --- a/bacula/platforms/redhat/bacula.spec.in +++ b/bacula/platforms/redhat/bacula.spec.in @@ -529,6 +529,17 @@ export LDFLAGS=-L/usr/lib64 export LDFLAGS=-L/usr/lib64/mysql %endif +%configure \ + --prefix=/usr \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc/bacula \ + --with-scriptdir=/etc/bacula \ + --enable-smartalloc \ + --enable-client-only \ + --enable-static-fd + +make + %configure \ --prefix=/usr \ --sbindir=/usr/sbin \ @@ -624,6 +635,8 @@ rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql %endif +rm -f $RPM_BUILD_ROOT/usr/sbin/static-bacula-fd + # install the init scripts %if %{su9} cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir @@ -695,6 +708,9 @@ cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT/etc/bacula/rescue/ +touch $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/rpm_release +cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/bacula/bin/bacula-fd +rm -f src/filed/static-bacula-fd # now clean up permissions that are left broken by the install chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql diff --git a/bacula/platforms/suse/bacula.spec.in b/bacula/platforms/suse/bacula.spec.in index c65223bc09..e0df4a6af1 100644 --- a/bacula/platforms/suse/bacula.spec.in +++ b/bacula/platforms/suse/bacula.spec.in @@ -529,6 +529,17 @@ export LDFLAGS=-L/usr/lib64 export LDFLAGS=-L/usr/lib64/mysql %endif +%configure \ + --prefix=/usr \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc/bacula \ + --with-scriptdir=/etc/bacula \ + --enable-smartalloc \ + --enable-client-only \ + --enable-static-fd + +make + %configure \ --prefix=/usr \ --sbindir=/usr/sbin \ @@ -624,6 +635,8 @@ rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql %endif +rm -f $RPM_BUILD_ROOT/usr/sbin/static-bacula-fd + # install the init scripts %if %{su9} cp -p platforms/suse/bacula-dir $RPM_BUILD_ROOT/etc/init.d/bacula-dir @@ -695,6 +708,9 @@ cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT/etc/bacula/rescue/ cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT/etc/bacula/rescue/ +touch $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/rpm_release +cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/bacula/bin/bacula-fd +rm -f src/filed/static-bacula-fd # now clean up permissions that are left broken by the install chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index 4c442816c8..3e5cc366fa 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -119,18 +119,6 @@ bool do_restore(JCR *jcr) fd = jcr->file_bsock; set_jcr_job_status(jcr, JS_Running); -#ifdef xxx - if (!send_include_list(jcr)) { - restore_cleanup(jcr, JS_ErrorTerminated); - return false; - } - - if (!send_exclude_list(jcr)) { - restore_cleanup(jcr, JS_ErrorTerminated); - return false; - } -#endif - /* * send Storage daemon address to the File daemon, * then wait for File daemon to make connection diff --git a/bacula/src/dird/ua.h b/bacula/src/dird/ua.h index 4498f05560..e88143095a 100644 --- a/bacula/src/dird/ua.h +++ b/bacula/src/dird/ua.h @@ -9,19 +9,14 @@ Copyright (C) 2000-2005 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ @@ -49,6 +44,7 @@ struct UAContext { bool quit; /* if set, quit */ bool verbose; /* set for normal UA verbosity */ bool batch; /* set for non-interactive mode */ + bool gui; /* set if talking to GUI program */ uint32_t pint32_val; /* positive integer */ int32_t int32_val; /* positive/negative */ int64_t int64_val; /* big int */ diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index 33a8343e5b..d97bf8a7fb 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -55,10 +55,10 @@ int autodisplay_cmd(UAContext *ua, const char *cmd) switch (find_arg_keyword(ua, kw)) { case 0: - ua->auto_display_messages = 1; + ua->auto_display_messages = true; break; case 1: - ua->auto_display_messages = 0; + ua->auto_display_messages = false; break; default: bsendmsg(ua, _("ON or OFF keyword missing.\n")); @@ -68,7 +68,7 @@ int autodisplay_cmd(UAContext *ua, const char *cmd) } /* - * Turn batch processing on/off + * Turn GUI mode on/off */ int gui_cmd(UAContext *ua, const char *cmd) { @@ -79,12 +79,10 @@ int gui_cmd(UAContext *ua, const char *cmd) switch (find_arg_keyword(ua, kw)) { case 0: - ua->batch = true; - ua->jcr->gui = true; + ua->jcr->gui = ua->gui = true; break; case 1: - ua->batch = false; - ua->jcr->gui = false; + ua->jcr->gui = ua->gui = false; break; default: bsendmsg(ua, _("ON or OFF keyword missing.\n")); @@ -649,7 +647,7 @@ void do_messages(UAContext *ua, const char *cmd) do_truncate = true; } if (do_truncate) { - ftruncate(fileno(con_fd), 0L); + (void)ftruncate(fileno(con_fd), 0L); } console_msg_pending = FALSE; ua->user_notified_msg_pending = FALSE; diff --git a/bacula/src/dird/ua_select.c b/bacula/src/dird/ua_select.c index 41765194a5..7a3b2e8254 100644 --- a/bacula/src/dird/ua_select.c +++ b/bacula/src/dird/ua_select.c @@ -711,10 +711,12 @@ int do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt, item = -1; goto done; } +// bnet_sig(ua->UA_sock, BNET_START_SELECT); bsendmsg(ua, ua->prompt[0]); for (i=1; i < ua->num_prompts; i++) { bsendmsg(ua, "%6d: %s\n", i, ua->prompt[i]); } +// bnet_sig(ua->UA_sock, BNET_END_SELECT); for ( ;; ) { /* First item is the prompt string, not the items */ diff --git a/bacula/src/dird/ua_server.c b/bacula/src/dird/ua_server.c index f4adaa2916..0ec2f11d3f 100644 --- a/bacula/src/dird/ua_server.c +++ b/bacula/src/dird/ua_server.c @@ -138,7 +138,7 @@ static void *handle_UA_client_request(void *arg) pm_strcpy(ua->cmd, "messages"); qmessagescmd(ua, ua->cmd); ua->user_notified_msg_pending = FALSE; - } else if (!ua->user_notified_msg_pending && console_msg_pending) { + } else if (!ua->gui && !ua->user_notified_msg_pending && console_msg_pending) { bsendmsg(ua, _("You have messages.\n")); ua->user_notified_msg_pending = TRUE; } diff --git a/bacula/src/lib/bnet_pkt.c b/bacula/src/lib/bnet_pkt.c deleted file mode 100644 index d84d241b5f..0000000000 --- a/bacula/src/lib/bnet_pkt.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Network Packet Utility Routines - * - * by Kern Sibbald, July MMII - * - * - * Version $Id$ - */ -/* - Copyright (C) 2002-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 - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - - */ - -#ifdef implemented - -#include "bacula.h" - -/* - * Receive a message from the other end. Each message consists of - * two packets. The first is a header that contains the size - * of the data that follows in the second packet. - * Returns number of bytes read - * Returns 0 on end of file - * Returns -1 on hard end of file (i.e. network connection close) - * Returns -2 on error - */ -int32_t -bnet_recv_pkt(BSOCK *bsock, BPKT *pkt, int *version) -{ - unser_declare; - short lversion; - int type; - - unser_begin(bsock->msg, 0); - unser_uint16(lversion); - *version = (int)lversion; - - - for ( ; pkt->type != BP_EOF; pkt++) { - if (pkt->id) { - ser_int8(BP_ID); - ser_string((char *)pkt->id); - } - ser_int8(pkt->type); - switch (pkt->type) { - case BP_CHAR: - ser_int8(*(int8_t *)pkt->value); - break; - case BP_INT32: - ser_int32(*(int32_t *)pkt->value); - break; - case BP_UINT32: - break; - ser_unit32(*(uint32_t *)pkt->value); - break; - case BP_INT64: - ser_int64(*(int64_t *)pkt->value); - break; - case BP_BTIME: - case BP_UTIME: - case BP_UINT64: - ser_uint64(*(uint64_t *)pkt->value); - break; - case BP_POOL: - case BP_STRING: - case BP_NAME: - ser_string((char *)pkt->value); - break; - case BP_BYTES: - ser_uint32(*(uint32_t *)pkt->len); - ser_bytes((char *)pkt->value, pkt->len); - break; - default: - Emsg1(M_ABORT, 0, _("Unknown BPKT type: %d\n"), pkt->type); - } - } - unser_end(bsock->msg, 0); - -} - -/* - * Send a message over the network. The send consists of - * 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 - */ -int -bnet_send_pkt(BSOCK *bsock, BPKT *pkt, int version) -{ - ser_declare; - - ser_begin(bsock->msg, 0); - ser_uint16(version); - - for ( ; pkt->type != BP_EOF; pkt++) { - if (pkt->id) { - ser_int8(BP_ID); - ser_string((char *)pkt->id); - } - ser_int8(pkt->type); - switch (pkt->type) { - case BP_CHAR: - ser_int8(*(int8_t *)pkt->value); - break; - case BP_INT32: - ser_int32(*(int32_t *)pkt->value); - break; - case BP_UINT32: - break; - ser_unit32(*(uint32_t *)pkt->value); - break; - case BP_INT64: - ser_int64(*(int64_t *)pkt->value); - break; - case BP_BTIME: - case BP_UTIME: - case BP_UINT64: - ser_uint64(*(uint64_t *)pkt->value); - break; - case BP_POOL: - case BP_STRING: - case BP_NAME: - ser_string((char *)pkt->value); - break; - case BP_BYTES: - ser_uint32(*(uint32_t *)pkt->len); - ser_bytes((char *)pkt->value, pkt->len); - break; - default: - Emsg1(M_ABORT, 0, _("Unknown BPKT type: %d\n"), pkt->type); - } - } - ser_end(bsock->msg, 0); -} - -#endif diff --git a/bacula/src/lib/bsock.h b/bacula/src/lib/bsock.h index 1282aa671b..22ed040f26 100644 --- a/bacula/src/lib/bsock.h +++ b/bacula/src/lib/bsock.h @@ -66,7 +66,9 @@ enum { BNET_HB_RESPONSE = -7, /* Only response permited to HB */ BNET_PROMPT = -8, /* Prompt for UA */ BNET_BTIME = -9, /* Send UTC btime */ - BNET_BREAK = -10 /* Stop current command -- ctl-c */ + BNET_BREAK = -10, /* Stop current command -- ctl-c */ + BNET_START_SELECT = -11, /* Start of a selection list */ + BNET_END_SELECT = -12 /* End of a select list */ }; #define BNET_SETBUF_READ 1 /* Arg for bnet_set_buffer_size */ @@ -85,35 +87,3 @@ enum { #define BNET_TLS_OK 1 /* can do, but not required on my end */ #define BNET_TLS_REQUIRED 2 /* TLS is required */ -/* - * This is the structure of the in memory BPKT - */ -typedef struct s_bpkt { - char *id; /* String identifier or name of field */ - uint8_t type; /* field type */ - uint32_t len; /* field length for string, name, bytes */ - void *value; /* pointer to value */ -} BPKT; - -/* - * These are the data types that can be sent. - * For all values other than string, the storage space - * is assumed to be allocated in the receiving packet. - * For BP_STRING if the *value is non-zero, it is a - * pointer to a POOLMEM buffer, and the Memory Pool - * routines will be used to assure that the length is - * adequate. NOTE!!! This pointer will be changed - * if the memory is reallocated (sort of like Mmsg(&pool) - * does). If the pointer is NULL, a POOLMEM - * buffer will be allocated. - */ -#define BP_EOF 0 /* end of file */ -#define BP_CHAR 1 /* Character */ -#define BP_INT32 1 /* 32 bit integer */ -#define BP_UINT32 3 /* Unsigned 32 bit integer */ -#define BP_INT64 4 /* 64 bit integer */ -#define BP_STRING 5 /* string */ -#define BP_NAME 6 /* Name string -- limited length */ -#define BP_BYTES 7 /* Binary bytes */ -#define BP_FLOAT32 8 /* 32 bit floating point */ -#define BP_FLOAT64 9 /* 64 bit floating point */ diff --git a/bacula/src/lib/bsys.c b/bacula/src/lib/bsys.c index 9c1a29d353..14e51cae1a 100644 --- a/bacula/src/lib/bsys.c +++ b/bacula/src/lib/bsys.c @@ -659,7 +659,7 @@ char *bfgets(char *s, int size, FILE *fd) *p = 0; } else { /* Mac (\r only) */ - ungetc(ch, fd); /* Push next character back to fd */ + (void)ungetc(ch, fd); /* Push next character back to fd */ } break; } diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index 86dbca7dd2..1a3813b051 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -266,6 +266,7 @@ DEVICE::open(DCR *dcr, int omode) } else { ::close(fd); /* use system close so correct mode will be used on open */ fd = -1; + clear_opened(); Dmsg0(100, "Close fd for mode change.\n"); } } @@ -383,6 +384,8 @@ void DEVICE::open_tape_device(DCR *dcr, int omode) use_count = 1; update_pos_dev(this); /* update position */ set_os_device_parameters(this); /* do system dependent stuff */ + } else { + clear_opened(); } /* Stop any open() timer we started */ @@ -429,6 +432,7 @@ void DEVICE::open_file_device(int omode) Mmsg(errmsg, _("Could not open file device %s. No Volume name given.\n"), print_name()); fd = -1; + clear_opened(); return; } @@ -453,6 +457,7 @@ void DEVICE::open_file_device(int omode) dev_errno = errno; Mmsg2(errmsg, _("Could not open: %s, ERR=%s\n"), archive_name.c_str(), be.strerror()); + clear_opened(); Dmsg1(29, "open failed: %s", errmsg); Emsg0(M_FATAL, 0, errmsg); } else { @@ -488,6 +493,7 @@ void DEVICE::open_dvd_device(DCR *dcr, int omode) Mmsg(errmsg, _("Could not open file device %s. No Volume name given.\n"), print_name()); fd = -1; + clear_opened(); return; } @@ -598,6 +604,7 @@ void DEVICE::open_dvd_device(DCR *dcr, int omode) /* Use system close() */ ::close(fd); fd = -1; + clear_opened(); } else { part_size = filestat.st_size; dev_errno = 0; @@ -618,6 +625,8 @@ void DEVICE::open_dvd_device(DCR *dcr, int omode) } }*/ } + } else { + clear_opened(); } } -- 2.39.5