fix(lisp): Don't assume a list representation in `eask-current-time' - #432
fix(lisp): Don't assume a list representation in `eask-current-time'#432alberti42 wants to merge 2 commits into
Conversation
`eask-current-time' rebuilt a seconds count from the first two elements of `current-time'. That representation is not guaranteed: it depends on `current-time-list', which defaults to nil as of Emacs 32, so `current-time' returns a (TICKS . HZ) cons cell rather than a (HIGH LOW USEC PSEC) list. `(cadr now)' then evaluates `(car 1000000000)', and `eask package' aborts with "Wrong type argument: listp, 1000000000", where the number is the HZ value from the cons cell. Use `float-time', which accepts either representation and is available in every Emacs version Eask supports (the declared floor is 26.1, so `time-convert' is not an option). The result is unchanged for the list representation. Fixes emacs-eask#431.
|
Since the workflow runs on this PR are held at The project's own test suite
npm ci
npm run test-reset
ALLOW_UNSAFE=1 EASK_COMMAND="node $PWD/eask.js" npx jest test/jest/install.test.js
Environment: GNU Emacs 32.0.50 (development build, 26 August 2026), macOS arm64, Node 26.5.0. Other checks
Check against a real project
So this change alone is sufficient, and the temporary |
Fixes #431.
Cause
eask-current-timerebuilt a seconds count out of the first two elements ofcurrent-time:That assumes
current-timereturns a(HIGH LOW USEC PSEC)list. The representation is not guaranteed: it depends oncurrent-time-list, which defaults tonilas of Emacs 32, socurrent-timereturns a(TICKS . HZ)cons cell instead.With the cons cell,
cdris the plain integer1000000000, so(cadr now)evaluates(car 1000000000)and signals. That integer isHZ, the unit of the tick count, which is why the reported error reads:Because
eask-current-timeis used to build the directory recipe,eask packageaborts before producing an artifact.Fix
Use
float-time, which accepts either representation.time-convertwould be the more direct API, but it requires Emacs 27.1 andeask-required-emacs-versionis26.1, sofloat-timeis used instead.float-timehas existed since Emacs 21.The result is unchanged for the list representation:
Integer seconds are represented exactly by a double up to roughly 9e15, so there is no precision concern for epoch timestamps.
I checked the rest of the tree: this was the only place a timestamp was decomposed by hand. The other
current-timecall sites inlisp/_prepare.elgo throughtime-subtractandfloat-time, and the vendoredpackage-buildcopies usefloat-timeorcurrent-time-string, all of which accept both representations.Verification
On GNU Emacs 32.0.50 (development build, 26 August 2026), with Eask 0.12.9 and this patch applied to the installed
lisp/_prepare.el:eask packagefails withWrong type argument: listp, 1000000000.eask packageandeask installboth succeed.I verified it against a real project rather than a synthetic one, using
lsp-mode, whose CI is currently blocked by this bug on all Unix Emacs snapshot jobs. With this patch,lsp-modebuilds with no changes on its side, so the workaround it needs today (settingcurrent-time-listback totin itsEaskfile) can be removed once this is released.