GNU bug report logs - #75849
30.0.93; format-seconds: sometimes broken for negative arguments

Previous Next

Package: emacs;

Reported by: "N. Jackson" <njackson <at> posteo.net>

Date: Sun, 26 Jan 2025 03:14:01 UTC

Severity: normal

Found in version 30.0.93

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#75849: closed (30.0.93; format-seconds: sometimes broken for
 negative arguments )
Date: Sun, 02 Feb 2025 16:51:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 2 Feb 2025 08:50:15 -0800
with message-id <c405487a-bd85-4eb3-8b12-0005f481c7fa <at> cs.ucla.edu>
and subject line Re: bug#75849: 30.0.93; format-seconds: sometimes broken for negative arguments
has caused the debbugs.gnu.org bug report #75849,
regarding 30.0.93; format-seconds: sometimes broken for negative arguments 
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
75849: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75849
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: "N. Jackson" <njackson <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.93; format-seconds: sometimes broken for negative arguments 
Date: Sun, 26 Jan 2025 03:12:47 +0000
With a negative argument, the function format-seconds sometimes
gives incorrect results.

For example:

  (format-seconds "%dd %hh %mm %ss" -20)  ; => "-1d 23h 59m 40s" (incorrect)

But it works correctly when the argument is positive and it works
correctly with the same negative agument but a simpler format
string:

  (format-seconds "%dd %hh %mm %ss" 20)   ; => "0d 0h 0m 20s" (correct)
  (format-seconds "%ss" 20)               ; => "20s" (correct)
  (format-seconds "%ss" -20)              ; => "-20s" (correct)

This bug also exists on master.  (I tested just now, after commit
35d39278599caf30eb4bfbd83118ffe15d2bc705 of Jan 25 21:18:00 2025
+0100).


In GNU Emacs 30.0.93 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.0) of 2024-12-20 built on fedora
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 40 (Xfce)

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
JPEG LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3
ZLIB

Important settings:
  value of $LANG: en_CA.utf8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  hl-line-mode: t
  gnus-undo-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  savehist-mode: t
  save-place-mode: t
  electric-pair-mode: t
  display-time-mode: t
  display-battery-mode: t
  delete-selection-mode: t
  cua-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow emacsbug mailalias smtpmail solar cal-dst holidays
holiday-loaddefs cal-iso mule-util cal-move bbdb-message sort
gnus-cite mail-extr textsec uni-scripts idna-mapping ucs-normalize
uni-confusable textsec-check gnus-async gnus-bcklg misearch
multi-isearch gnus-kill qp gnus-ml disp-table hl-line nndraft nnmh
utf-7 epa-file network-stream nsm nnfolder bbdb-gnus bbdb-mua nnnil
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig nntp
gnus-cache gnus-sum shr pixel-fill kinsoku url-file svg dom
gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail
mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int
gnus-range message sendmail yank-media puny dired dired-loaddefs
rfc822 mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums gmm-utils
mailheader gnus-win gnus nnheader gnus-util mail-utils range mm-util
mail-prsvr org-habit wheatgrass-theme display-fill-column-indicator
display-line-numbers flyspell ispell kmacro mines derived cookie1
gamegrid transpar expand-region text-mode-expansions
the-org-mode-expansions python-el-fgallina-expansions
er-basic-expansions expand-region-core expand-region-custom hydra
advice lv compile text-property-search org-clock comp-run
comp-common org-agenda org-element org-persist xdg org-id
org-element-ast inline avl-tree generator org-refile org org-macro
org-pcomplete org-list org-footnote org-faces org-entities time-date
noutline outline ob-shell shell pcomplete ob-R ob-python python
project compat ob-plantuml ob-org ob-gnuplot ob-ditaa ob-calc
calc-store calc-trail calc-ext calc calc-loaddefs rect calc-macs
ob-awk ob-dot ob-maxima ob ob-tangle org-src sh-script smie treesit
executable ob-ref ob-lob ob-table ob-exp ob-comint comint ansi-osc
ansi-color ring ob-emacs-lisp ob-core ob-eval org-cycle org-table
org-keys oc org-loaddefs thingatpt find-func ol org-fold
org-fold-core org-compat org-version org-macs bbdb-anniv diary-lib
diary-loaddefs cal-menu calendar cal-loaddefs bbdb-com crm
mailabbrev bbdb bbdb-site timezone recentf tree-widget cus-edit pp
wid-edit ido format-spec modus-vivendi-theme modus-themes
yasnippet-classic-snippets cl-extra yasnippet help-mode savehist
saveplace company pcase elec-pair time battery dbus xml desktop
frameset delsel cua-base cus-load ace-window-autoloads
auctex-autoloads tex-site avy-autoloads bbdb-autoloads
cdlatex-autoloads company-autoloads csv-mode-autoloads
debbugs-autoloads ess-autoloads expand-region-autoloads
geiser-autoloads info orderless-autoloads rx sql-indent-autoloads
yasnippet-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs icons password-cache json subr-x map
byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock
syntax font-core term/tty-colors frame minibuffer nadvice seq simple
cl-generic indonesian philippine cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded
button loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads
dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty
move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 807911 185147) (symbols 48 35500 2)
 (strings 32 181596 16153) (string-bytes 1 5822983) (vectors 16 71382)
 (vector-slots 8 917693 93308) (floats 8 938 970)
 (intervals 56 3347 2404) (buffers 984 23))


[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 75849-done <at> debbugs.gnu.org, "N. Jackson" <njackson <at> posteo.net>
Subject: Re: bug#75849: 30.0.93; format-seconds: sometimes broken for negative
 arguments
Date: Sun, 2 Feb 2025 08:50:15 -0800
[Message part 4 (text/plain, inline)]
On 2025-01-30 04:10, Eli Zaretskii wrote:
> Paul, could you please take a look at this?

I installed the attached which I think fixes this particular problem.

I hope we can find someone else to maintain format-seconds, by the way. 
That code is not my cup of tea.
[0001-Improve-format-seconds-on-negative-args.patch (text/x-patch, attachment)]

This bug report was last modified 159 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.