Subject: 23.1.90; Error "Args out of range" when formatting string w/ text properties

From: David Maus <[email-masked]>
Date: Sun, 03 Jan 2010 22:51:43 +0100

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug.  If you can, give
a recipe starting from `emacs -Q':

When formatting a string using the %s format specifier with a input
string that has a text property under certain circumstances Emacs
throws an args-out-of-range error.

Steps to reproduce:

  - Evaluate this (emacs -Q):

    (format "%.10s" (concat "1234567890aaaa" (propertize "12345678901234567890" 'xxx 25)))

  - Gives

    Debugger entered--Lisp error: (args-out-of-range 10 14)
    format("%.10s" #("1234567890aaaa12345678901234567890" 14 34 (xxx 25)))
    eval((format "%.10s" (concat "1234567890aaaa" (propertize "12345678901234567890" ... 25))))
    eval-last-sexp-1(nil)
    eval-last-sexp(nil)
    call-interactively(eval-last-sexp nil nil)

The problem seems not to occur when the propertized part is not
outside the part that gets formatted into the string.

I.e., this works:

(format "%.10s" (concat "123456789" (propertize "12345678901234567890" 'xxx 25)))

   -- David

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/23.1.90/etc/DEBUG.

In GNU Emacs 23.1.90.1 (i486-pc-linux-gnu, GTK+ Version 2.18.5)
 of 2009-12-17 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20091217-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.1.90/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1.90/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: de_DE.UTF-8
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Org

Minor modes in effect:
  diff-auto-refine-mode: t
  iswitchb-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-c a C-g C-c a R <down> <down> <tab> <tab> <down>
<down> <down> C-SPC <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> M-w M-x r e p <tab> o <tab> r <tab> b <tab>
<return> E r r r o r SPC <backspace> <backspace> <backspace>
<backspace> o r SPC " A r g s SPC o t SPC o <backspace>
<backspace> <backspace> t <backspace> u t SPC o f SPC
r a n g e SPC <backspace> 2 <backspace> " SPC w h e
n SPC f o r m a t t i n g SPC s r <backspace> t r i
n g SPC w / SPC t e x t SPC p r o p e r t i e s <return>
C-^ c C-c w C-^ p M-x <up> <return>

Recent messages:
Loading msgdb for @rss-hash.ChaosradioExpress...done
Checking "@rss-hash.Fefe"
Loading msgdb for @rss-hash.Fefe...done
Checking "@rss-hash.HectorPostigo"
Loading msgdb for @rss-hash.HectorPostigo...done
Checking "@rss-hash.Gulli"
Loading msgdb for @rss-hash.Gulli...done
Checking "@rss-hash.iRights"
Loading msgdb for @rss-hash.iRights...done
Checking "Desktop" is done

Load-path shadows:
~/code/remote/org-mode/contrib/lisp/htmlize hides /usr/share/emacs-snapshot/site-lisp/emacs-goodies-el/htmlize
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info
/usr/share/emacs/23.1.90/site-lisp/auctex/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl
/usr/share/emacs/23.1.90/site-lisp/auctex/context-en hides /usr/share/emacs/site-lisp/auctex/context-en
/usr/share/emacs/23.1.90/site-lisp/auctex/latex hides /usr/share/emacs/site-lisp/auctex/latex
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-mik hides /usr/share/emacs/site-lisp/auctex/tex-mik
/usr/share/emacs-snapshot/site-lisp/dictionary-el/lpath hides /usr/share/emacs/site-lisp/auctex/lpath
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-bar hides /usr/share/emacs/site-lisp/auctex/tex-bar
/usr/share/emacs/23.1.90/site-lisp/auctex/tex hides /usr/share/emacs/site-lisp/auctex/tex
/usr/share/emacs/23.1.90/site-lisp/auctex/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-fptex hides /usr/share/emacs/site-lisp/auctex/tex-fptex
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-font hides /usr/share/emacs/site-lisp/auctex/tex-font
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-fold hides /usr/share/emacs/site-lisp/auctex/tex-fold
/usr/share/emacs/23.1.90/site-lisp/auctex/texmathp hides /usr/share/emacs/site-lisp/auctex/texmathp
/usr/share/emacs/23.1.90/site-lisp/auctex/context hides /usr/share/emacs/site-lisp/auctex/context
/usr/share/emacs/23.1.90/site-lisp/auctex/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex
/usr/share/emacs/23.1.90/site-lisp/auctex/bib-cite hides /usr/share/emacs/site-lisp/auctex/bib-cite
/usr/share/emacs/23.1.90/site-lisp/auctex/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x
/usr/share/emacs/23.1.90/site-lisp/auctex/tex-style hides /usr/share/emacs/site-lisp/auctex/tex-style
/usr/share/emacs/23.1.90/site-lisp/magit hides /usr/share/emacs/site-lisp/magit
/usr/share/emacs/23.1.90/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs-snapshot/site-lisp/semi/pgg-pgp5 hides /usr/share/emacs/23.1.90/lisp/pgg-pgp5
/usr/share/emacs-snapshot/site-lisp/semi/pgg-def hides /usr/share/emacs/23.1.90/lisp/pgg-def
/usr/share/emacs-snapshot/site-lisp/semi/pgg-parse hides /usr/share/emacs/23.1.90/lisp/pgg-parse
/usr/share/emacs-snapshot/site-lisp/flim/sha1 hides /usr/share/emacs/23.1.90/lisp/sha1
/usr/share/emacs-snapshot/site-lisp/semi/pgg hides /usr/share/emacs/23.1.90/lisp/pgg
/usr/share/emacs-snapshot/site-lisp/semi/pgg-pgp hides /usr/share/emacs/23.1.90/lisp/pgg-pgp
/usr/share/emacs-snapshot/site-lisp/semi/pgg-gpg hides /usr/share/emacs/23.1.90/lisp/pgg-gpg
/usr/share/emacs-snapshot/site-lisp/flim/hex-util hides /usr/share/emacs/23.1.90/lisp/hex-util
/usr/share/emacs-snapshot/site-lisp/flim/md4 hides /usr/share/emacs/23.1.90/lisp/md4
/usr/share/emacs-snapshot/site-lisp/ruby1.8-elisp/ruby-mode hides /usr/share/emacs/23.1.90/lisp/progmodes/ruby-mode
~/code/remote/org-mode/lisp/org-colview hides /usr/share/emacs/23.1.90/lisp/org/org-colview
~/code/remote/org-mode/lisp/org-exp hides /usr/share/emacs/23.1.90/lisp/org/org-exp
~/code/remote/org-mode/lisp/org-plot hides /usr/share/emacs/23.1.90/lisp/org/org-plot
~/code/remote/org-mode/lisp/org-feed hides /usr/share/emacs/23.1.90/lisp/org/org-feed
~/code/remote/org-mode/lisp/org-wl hides /usr/share/emacs/23.1.90/lisp/org/org-wl
~/code/remote/org-mode/lisp/org-vm hides /usr/share/emacs/23.1.90/lisp/org/org-vm
~/code/remote/org-mode/lisp/org-datetree hides /usr/share/emacs/23.1.90/lisp/org/org-datetree
~/code/remote/org-mode/lisp/org-id hides /usr/share/emacs/23.1.90/lisp/org/org-id
~/code/remote/org-mode/lisp/org-indent hides /usr/share/emacs/23.1.90/lisp/org/org-indent
~/code/remote/org-mode/lisp/org hides /usr/share/emacs/23.1.90/lisp/org/org
~/code/remote/org-mode/lisp/org-timer hides /usr/share/emacs/23.1.90/lisp/org/org-timer
~/code/remote/org-mode/lisp/org-attach hides /usr/share/emacs/23.1.90/lisp/org/org-attach
~/code/remote/org-mode/lisp/org-footnote hides /usr/share/emacs/23.1.90/lisp/org/org-footnote
~/code/remote/org-mode/lisp/org-irc hides /usr/share/emacs/23.1.90/lisp/org/org-irc
~/code/remote/org-mode/lisp/org-jsinfo hides /usr/share/emacs/23.1.90/lisp/org/org-jsinfo
~/code/remote/org-mode/lisp/org-compat hides /usr/share/emacs/23.1.90/lisp/org/org-compat
~/code/remote/org-mode/lisp/org-mac-message hides /usr/share/emacs/23.1.90/lisp/org/org-mac-message
~/code/remote/org-mode/lisp/org-archive hides /usr/share/emacs/23.1.90/lisp/org/org-archive
~/code/remote/org-mode/lisp/org-bibtex hides /usr/share/emacs/23.1.90/lisp/org/org-bibtex
~/code/remote/org-mode/lisp/org-faces hides /usr/share/emacs/23.1.90/lisp/org/org-faces
~/code/remote/org-mode/lisp/org-clock hides /usr/share/emacs/23.1.90/lisp/org/org-clock
~/code/remote/org-mode/lisp/org-mouse hides /usr/share/emacs/23.1.90/lisp/org/org-mouse
~/code/remote/org-mode/lisp/org-list hides /usr/share/emacs/23.1.90/lisp/org/org-list
~/code/remote/org-mode/lisp/org-rmail hides /usr/share/emacs/23.1.90/lisp/org/org-rmail
~/code/remote/org-mode/lisp/org-latex hides /usr/share/emacs/23.1.90/lisp/org/org-latex
~/code/remote/org-mode/lisp/org-icalendar hides /usr/share/emacs/23.1.90/lisp/org/org-icalendar
~/code/remote/org-mode/lisp/org-ascii hides /usr/share/emacs/23.1.90/lisp/org/org-ascii
~/code/remote/org-mode/lisp/org-inlinetask hides /usr/share/emacs/23.1.90/lisp/org/org-inlinetask
~/code/remote/org-mode/lisp/org-habit hides /usr/share/emacs/23.1.90/lisp/org/org-habit
~/code/remote/org-mode/lisp/org-publish hides /usr/share/emacs/23.1.90/lisp/org/org-publish
~/code/remote/org-mode/lisp/org-macs hides /usr/share/emacs/23.1.90/lisp/org/org-macs
~/code/remote/org-mode/lisp/org-src hides /usr/share/emacs/23.1.90/lisp/org/org-src
~/code/remote/org-mode/lisp/org-mhe hides /usr/share/emacs/23.1.90/lisp/org/org-mhe
~/code/remote/org-mode/lisp/org-bbdb hides /usr/share/emacs/23.1.90/lisp/org/org-bbdb
~/code/remote/org-mode/lisp/org-table hides /usr/share/emacs/23.1.90/lisp/org/org-table
~/code/remote/org-mode/lisp/org-xoxo hides /usr/share/emacs/23.1.90/lisp/org/org-xoxo
~/code/remote/org-mode/lisp/org-mew hides /usr/share/emacs/23.1.90/lisp/org/org-mew
~/code/remote/org-mode/lisp/org-remember hides /usr/share/emacs/23.1.90/lisp/org/org-remember
~/code/remote/org-mode/lisp/org-html hides /usr/share/emacs/23.1.90/lisp/org/org-html
~/code/remote/org-mode/lisp/org-mobile hides /usr/share/emacs/23.1.90/lisp/org/org-mobile
~/code/remote/org-mode/lisp/org-crypt hides /usr/share/emacs/23.1.90/lisp/org/org-crypt
~/code/remote/org-mode/lisp/org-agenda hides /usr/share/emacs/23.1.90/lisp/org/org-agenda
~/code/remote/org-mode/lisp/org-protocol hides /usr/share/emacs/23.1.90/lisp/org/org-protocol
~/code/remote/org-mode/lisp/org-gnus hides /usr/share/emacs/23.1.90/lisp/org/org-gnus
~/code/remote/org-mode/lisp/org-w3m hides /usr/share/emacs/23.1.90/lisp/org/org-w3m
~/code/remote/org-mode/lisp/org-freemind hides /usr/share/emacs/23.1.90/lisp/org/org-freemind
~/code/remote/org-mode/lisp/org-docbook hides /usr/share/emacs/23.1.90/lisp/org/org-docbook
~/code/remote/org-mode/lisp/org-exp-blocks hides /usr/share/emacs/23.1.90/lisp/org/org-exp-blocks
~/code/remote/org-mode/lisp/org-info hides /usr/share/emacs/23.1.90/lisp/org/org-info
/usr/share/emacs-snapshot/site-lisp/flim/hmac-md5 hides /usr/share/emacs/23.1.90/lisp/net/hmac-md5
/usr/share/emacs-snapshot/site-lisp/flim/sasl-cram hides /usr/share/emacs/23.1.90/lisp/net/sasl-cram
/usr/share/emacs-snapshot/site-lisp/flim/ntlm hides /usr/share/emacs/23.1.90/lisp/net/ntlm
/usr/share/emacs-snapshot/site-lisp/flim/sasl hides /usr/share/emacs/23.1.90/lisp/net/sasl
/usr/share/emacs-snapshot/site-lisp/flim/hmac-def hides /usr/share/emacs/23.1.90/lisp/net/hmac-def
/usr/share/emacs-snapshot/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/23.1.90/lisp/net/sasl-ntlm
/usr/share/emacs-snapshot/site-lisp/flim/sasl-digest hides /usr/share/emacs/23.1.90/lisp/net/sasl-digest
~/.emacs.d/site-lisp/wl/rfc2368 hides /usr/share/emacs/23.1.90/lisp/mail/rfc2368
~/.emacs.d/site-lisp/wl/utf7 hides /usr/share/emacs/23.1.90/lisp/gnus/utf7
~/code/remote/emms/lisp/tq hides /usr/share/emacs/23.1.90/lisp/emacs-lisp/tq

Features:
(shadow wl-mime mime-play filename mime-edit pgg-parse pccl pccl-20
pgg-def signature mime-setup mail-mime-setup semi-setup mime-image
modb-legacy sb-rss-hash sb-atom-hash sb-hash sb-atom sb-rss
elmo-shimbun modb-standard ssl elmo-imap4 time-stamp elmo-net elmo-dop
elmo-cache elmo-map elmo-filter emacsbug help-mode view url-cache
server org-checklist org-depend org-crypt tabify vc-git org-babel-ruby
inf-ruby ruby-mode org-publish org-wl org-w3m org-vm org-rmail org-mhe
org-mew org-irc org-jsinfo org-infojs org-html org-exp org-agenda
org-info org-gnus org-docview org-bibtex org-bbdb org-fireforg bibtex
org-protocol remember org-remember org-datetree find-lisp diary-lib
diary-loaddefs dictem magit diff-mode log-edit pcvs-util add-log
parse-time moz pwsafe anything-config compile w3m-bookmark rx anything
woman man assoc bbdb-wl bbdb-hooks bbdb-com warnings
emms-lastfm-client xml emms-cue emms-playlist-limit emms-volume
emms-volume-amixer emms-tag-editor emms-info-metaflac emms-i18n
emms-mark emms-history emms-bookmarks emms-score emms-stream-info
emms-metaplaylist-mode emms-mode-line-icon emms-browser sort
emms-playlist-sort emms-last-played emms-player-xine emms-playing-time
emms-lyrics emms-streams emms-mode-line emms-cache emms-info-ogginfo
emms-info-mp3info emms-info later-do emms-playlist-mode
emms-player-vlc emms-player-mplayer emms-player-mpd emms-url tq
emms-source-playlist emms-source-file locate emms-player-simple
emms-setup emms emms-compat shimbun mime-w3m w3m doc-view image-mode
w3m-hist w3m-fb w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc
w3m-util namazu jka-compr browse-url elscreen-dired elscreen-server
wl-demo wl-draft eword-encode wl-template wl-news wl-address wl-thread
wl-action wl-summary ps-print ps-def lpr wl-refile wl-message
elmo-mime mmelmo-buffer mmelmo-imap mime-view mime-conf calist
semi-def mmimap mime-parse mmbuffer mmgeneric wl-highlight elmo-multi
wl-folder wl wl-e21 wl-util pp elmo-flag elmo-localdir wl-vars
epg-config wl-version elmo elmo-signal elmo-msgdb modb modb-generic
modb-entity mime elmo-util emu invisible inv-19 poem poem-e20
poem-e20_3 utf7 eword-decode mel mime-def std11 mcharset mcs-20
mcs-e20 pces pces-e20 pces-20 broken pcustom elmo-date elmo-vars
elmo-version luna elscreen-wl elscreen-w3m elscreen-color-theme
mule-util alist elscreen bbdb iswitchb color-theme url-http tls
url-auth url-gw auto-install edmacro kmacro thingatpt find-func dired
url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-util url-parse timezone url-vars gist-autoloads
highlight-parentheses-autoloads package reporter org-babel-init
org-babel-sh shell org-babel-emacs-lisp org-babel-keys
org-babel-tangle org-babel-lob generic org-babel-comint comint ring
org-babel-table org-babel-exp org-babel-ref org-babel org-exp-blocks
org-table org byte-opt bytecomp byte-compile advice help-fns
advice-preload derived org-footnote org-src org-list org-faces
org-compat org-macs noutline outline easy-mmode cal-menu calendar
cal-loaddefs gnus-sum nnoo gnus-group gnus-undo nnmail mail-source
format-spec gnus-start gnus-spec gnus-int gnus-range message sendmail
regexp-opt ecomplete rfc822 mml easymenu mml-sec password-cache
mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047
rfc2045 qp ietf-drums mailabbrev gmm-utils mailheader canlock sha1
sha1-el hex-util hashcash gnus-win gnus gnus-ems nnheader gnus-util
netrc time-date mail-utils mm-util mail-prsvr wid-edit cl cl-19
org-install debian-el debian-el-loaddefs path-util poe pym static
apel-ver product emacs-goodies-el emacs-goodies-custom
emacs-goodies-loaddefs bbdb-autoloads preview-latex tex-site
auto-loads tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win
x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode
register page menu-bar rfn-eshadow timer select scroll-bar mldrag
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
loaddefs button minibuffer faces cus-face files text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
font-render-setting gtk x-toolkit x multi-tty emacs)