In using 'ar' to store empty timestamp files I found that it is sensitive to
member file names of the form "Sxyz*" where x, y, z are hex digits (upper or
lower case). The following shell script is a distillation of the problem and
contains comments concerning it:
#!/bin/bash
#-
# Usage: ar-bug
#-
# Demonstrates a bug in GNU ar 2.17 (also in 2.15).
#-
# The first archive member name is irrelevant.
cat /dev/null > member1
# The following archive member names trigger the bug. The name must start
# with "S"; it seems that the second char must be a hex digit; the third and
# fourth characters are interpreted as a hex offset from the fifth char,
# skipping two chars per increment. The remaining chars don't matter.
cat /dev/null > SF00abcdefgh
cat /dev/null > SF01ijklmnop
cat /dev/null > SF02qrstuvwx
ar --version
echo
rm -f libS.a
ar r libS.a member1 SF00abcdefgh SF01ijklmnop SF02qrstuvwx
# Name doesn't matter (but must differ from the above).
cat /dev/null > dummy
# Now the following...
ar r libS.a dummy
# ...should produce:
#
# BFD: libS.a(member1):1: Unexpected character `a' in S-record file
#
# BFD: libS.a(SF00abcdefgh):1: Unexpected character `k' in S-record file
#
# BFD: libS.a(SF01ijklmnop):1: Unexpected character `u' in S-record file
#
# ('ranlib libS.a' produces the same result). The "unexpected" character
# is the one indicated by the hex offset in the "Sxyz*" member name.
# No error is reported if the "S" modifier is used in ar, indicating that
# the error is indeed coming from ranlib.
ar rS libS.a dummy
echo
echo "Listing of archive file:"
cat libS.a
The script produced the following output for me:
grus-189% ar-bug
GNU ar 2.17
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
ar: creating libS.a
BFD: libS.a(member1):1: Unexpected character `a' in S-record file
BFD: libS.a(SF00abcdefgh):1: Unexpected character `k' in S-record file
BFD: libS.a(SF01ijklmnop):1: Unexpected character `u' in S-record file
Listing of archive file:
!
member1/1165895102 355 1030 100644 0 `
SF00abcdefgh/ 1165895102 355 1030 100644 0 `
SF01ijklmnop/ 1165895102 355 1030 100644 0 `
SF02qrstuvwx/ 1165895102 355 1030 100644 0 `
dummy/ 1165895102 355 1030 100644 0 `
grus-190%
Other useful information:
grus-190% uname -a
Linux grus 2.6.13.3 #1 SMP Tue Oct 11 12:39:54 EST 2005 i686 GNU/Linux
grus-191% cat /etc/debian_version
3.1
grus-192%
Thanks, Mark
--
Summary: ar reports unexpected character in S-record file
Product: binutils
Version: 2.17
Status: NEW
Severity: normal
Priority: P2
Component: binutils
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: mcalabre at atnf dot csiro dot au
CC: bug-binutils at gnu dot org,mcalabre at atnf dot csiro
dot au
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=3704
--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.
___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils