]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.2.4-ansi-label.patch
Zeroth integration of plugins
[bacula/bacula] / bacula / patches / 2.2.4-ansi-label.patch
1  
2  This patch fixes bug #954.
3  WEOF on non-appendable error when trying to label a tape with ANSI labels turned on.
4
5  Apply it to version 2.2.4 (possibly earlier versions with):
6
7  cd <bacula-source>
8  patch -p0 <2.2.4-verify.patch
9  ./configure (your options)
10  make
11  ...
12  make install
13
14 Index: block.c
15 ===================================================================
16 --- src/stored/block.c  (revision 5615)
17 +++ src/stored/block.c  (revision 5615)
18 @@ -273,6 +273,7 @@
19        dev->dev_errno = EIO;
20        Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer discarded.\n"),
21            dev->file, dev->block_num, BLKHDR2_ID, Id);
22 +      Dmsg1(50, "%s", dev->errmsg);
23        if (block->read_errors == 0 || verbose >= 2) {
24           Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
25        }
26 @@ -1008,8 +1009,19 @@
27        dev->set_ateof();
28        return false;             /* return eof */
29     }
30 +
31     /* Continue here for successful read */
32 +
33     block->read_len = stat;      /* save length read */
34 +   if (dev->at_eof() && block->read_len == 80 && 
35 +        (dcr->VolCatInfo.LabelType != B_BACULA_LABEL ||
36 +         dcr->device->label_type != B_BACULA_LABEL)) {
37 +      /* ***FIXME*** should check label */
38 +      Dmsg2(100, "Ignore 80 byte ANSI label at %u:%u\n", dev->file, dev->block_num);
39 +      dev->clear_eof();
40 +      goto reread;             /* skip ANSI/IBM label */
41 +   }
42 +                                          
43     if (block->read_len < BLKHDR2_LENGTH) {
44        dev->dev_errno = EIO;
45        Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Very short block of %d bytes on device %s discarded.\n"),
46
47 Index: label.c
48 ===================================================================
49 --- src/stored/label.c  (revision 5602)
50 +++ src/stored/label.c  (working copy)
51 @@ -119,7 +119,6 @@
52     bstrncpy(dev->VolHdr.Id, "**error**", sizeof(dev->VolHdr.Id));
53  
54    /* Read ANSI/IBM label if so requested */
55 -  
56    want_ansi_label = dcr->VolCatInfo.LabelType != B_BACULA_LABEL ||
57                      dcr->device->label_type != B_BACULA_LABEL;
58    if (want_ansi_label || dev->has_cap(CAP_CHECKLABELS)) {
59 @@ -344,6 +343,9 @@
60        }
61     }
62  
63 +   /* Temporarily mark in append state to enable writing */
64 +   dev->set_append();
65 +
66     /* Create PRE_LABEL or VOL_LABEL if DVD */
67     create_volume_label(dev, VolName, PoolName, dvdnow);
68  
69 @@ -364,8 +366,6 @@
70     create_volume_label_record(dcr, dcr->rec);
71     dcr->rec->Stream = 0;
72  
73 -   /* Temporarily mark in append state to enable writing */
74 -   dev->set_append();
75     if (!write_record_to_block(dcr->block, dcr->rec)) {
76        Dmsg2(130, "Bad Label write on %s: ERR=%s\n", dev->print_name(), dev->print_errmsg());
77        goto bail_out;