2 This patch fixes bug #954.
3 WEOF on non-appendable error when trying to label a tape with ANSI labels turned on.
5 Apply it to version 2.2.4 (possibly earlier versions with):
8 patch -p0 <2.2.4-verify.patch
9 ./configure (your options)
15 ===================================================================
16 --- src/stored/block.c (revision 5615)
17 +++ src/stored/block.c (revision 5615)
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);
26 @@ -1008,8 +1009,19 @@
28 return false; /* return eof */
31 /* Continue here for successful read */
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);
40 + goto reread; /* skip ANSI/IBM label */
43 if (block->read_len < BLKHDR2_LENGTH) {
45 Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Very short block of %d bytes on device %s discarded.\n"),
48 ===================================================================
49 --- src/stored/label.c (revision 5602)
50 +++ src/stored/label.c (working copy)
52 bstrncpy(dev->VolHdr.Id, "**error**", sizeof(dev->VolHdr.Id));
54 /* Read ANSI/IBM label if so requested */
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)) {
63 + /* Temporarily mark in append state to enable writing */
66 /* Create PRE_LABEL or VOL_LABEL if DVD */
67 create_volume_label(dev, VolName, PoolName, dvdnow);
70 create_volume_label_record(dcr, dcr->rec);
73 - /* Temporarily mark in append state to enable writing */
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());