"panic: runtime error: slice bounds out of range" while installing any snap package

Bug #1876583 reported by Ihor Romanyshyn
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Fix Released
Undecided
Maciej Borzecki

Bug Description

Hi there!
I'm receiving an error message about "slice bounds out of range" every time after installing of any snap package. Here is one:

ihor@ihor-dell:~$ sudo snap install insomnia
[sudo] пароль до ihor:
panic: runtime error: slice bounds out of range [123:122] [recovered]
 panic: runtime error: slice bounds out of range [123:122]

goroutine 1 [running]:
main.main.func1()
 github.com/snapcore/snapd/cmd/snap/main.go:477 +0x95
panic(0x56200f5dec80, 0xc000406920)
 runtime/panic.go:679 +0x1b6
github.com/snapcore/snapd/progress.(*ANSIMeter).Set(0xc0000af950, 0x418e238000000000)
 github.com/snapcore/snapd/progress/ansimeter.go:152 +0xa1b
main.waitMixin.wait(0xc00033c1c0, 0x56200f1c0000, 0xc0003b4310, 0x2, 0x0, 0x0, 0x0)
 github.com/snapcore/snapd/cmd/snap/wait.go:130 +0x700
main.(*cmdInstall).installOne(0xc000351360, 0x7ffe74e1f8a9, 0x8, 0x0, 0x0, 0xc00038a360, 0x56200f5e9060, 0x56200f64d3a0)
 github.com/snapcore/snapd/cmd/snap/cmd_snap_op.go:491 +0x316
main.(*cmdInstall).Execute(0xc000351360, 0xc0002dbd20, 0x0, 0x2, 0xc000351360, 0x1)
 github.com/snapcore/snapd/cmd/snap/cmd_snap_op.go:596 +0x3d7
github.com/snapcore/snapd/vendor/github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc000312d90, 0xc000032190, 0x2, 0x2, 0xc0002bd770, 0xc00026fcd0, 0x56200ec2dfbd, 0x56200f5b48a0, 0xc0002bd770)
 github.com/snapcore/snapd/vendor/github.com/jessevdk/go-flags/parser.go:333 +0x8e7
github.com/snapcore/snapd/vendor/github.com/jessevdk/go-flags.(*Parser).Parse(...)
 github.com/snapcore/snapd/vendor/github.com/jessevdk/go-flags/parser.go:190
main.run(0xc00026fde0, 0xe)
 github.com/snapcore/snapd/cmd/snap/main.go:515 +0xa7
main.main()
 github.com/snapcore/snapd/cmd/snap/main.go:482 +0x371

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: snapd 2.44.3+20.04
ProcVersionSignature: Ubuntu 5.4.0-29.33-generic 5.4.30
Uname: Linux 5.4.0-29-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu27
Architecture: amd64
CasperMD5CheckResult: skip
Date: Sun May 3 16:41:40 2020
InstallationDate: Installed on 2020-04-29 (3 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=uk_UA.UTF-8
 SHELL=/bin/bash
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Ihor Romanyshyn (iromanyshyn) wrote :
Revision history for this message
Ian Johnson (anonymouse67) wrote :

Hi, thanks for reporting, does the same problem happen if you use `snap install --unicode=never --color=never insomnia` ?

If it does still panic, can you try the following:

id=$(snap install hello-world --no-wait)
until snap changes | grep -P "^$id\s+Done"; do echo snap changes | grep -P "^$id"; done
snap run hello-world

and post the output from that?

Changed in snapd (Ubuntu):
status: New → Incomplete
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks! This is probably locale related, the relevant code in ansimeter:
"""
        fmt.Fprint(stdout, "\r", enterReverseMode, string(msg[:i]), exitAttributeMode, string(msg[i:]))
"""
could be mixing of rune byte?

Revision history for this message
Ihor Romanyshyn (iromanyshyn) wrote :

Hi Ian!
Still panic. Here is output you asked:

ihor@ihor-dell:~$ id=$(snap install hello-world --no-wait)
ihor@ihor-dell:~$ until snap changes | grep -P "^$id\s+Done"; do echo snap changes | grep -P "^$id"; done
30 Done сьогодні о 16:41 EEST сьогодні о 16:41 EEST Встановити snap-пакунок "hello-world"
ihor@ihor-dell:~$ snap run hello-world
Hello World!

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

What's the chance this fails because of i18n?

Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

@iromanyshyn: can you try `LC_ALL=C.UTF-8 snap install hello-world` ?

Revision history for this message
Ihor Romanyshyn (iromanyshyn) wrote :

@maciek-borzecki, hello-world installed without errors. But when i tried to install another snap:

ihor@ihor-dell:~$ LC_ALL=C.UTF-8 snap install warzone2100
panic: runtime error: slice bounds out of range [80:79] [recovered]
 panic: runtime error: slice bounds out of range [80:79]

goroutine 1 [running]:
main.main.func1()
 github.com/snapcore/snapd/cmd/snap/main.go:477 +0x95
panic(0x561d5f7fac80, 0xc000144280)
 runtime/panic.go:679 +0x1b6
github.com/snapcore/snapd/progress.(*ANSIMeter).Set(0xc000214eb0, 0x41a891a000000000)
 github.com/snapcore/snapd/progress/ansimeter.go:152 +0xa1b
main.waitMixin.wait(0xc0002e42a0, 0x561d5f3e0000, 0xc0001e4488, 0x2, 0x0, 0x0, 0x0)
 github.com/snapcore/snapd/cmd/snap/wait.go:130 +0x700
main.(*cmdInstall).installOne(0xc000359040, 0x7ffcf44c33e4, 0xb, 0x0, 0x0, 0xc00036cba0, 0x561d5f805060, 0x561d5f8693a0)
 github.com/snapcore/snapd/cmd/snap/cmd_snap_op.go:491 +0x316
main.(*cmdInstall).Execute(0xc000359040, 0xc0003787a0, 0x0, 0x2, 0xc000359040, 0x1)
 github.com/snapcore/snapd/cmd/snap/cmd_snap_op.go:596 +0x3d7
github.com/snapcore/snapd/vendor/github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc000316bd0, 0xc000032190, 0x2, 0x2, 0xc000330330, 0xc0002a5cd0, 0x561d5ee49fbd, 0x561d5f7d08a0, 0xc000330330)
 github.com/snapcore/snapd/vendor/github.com/jessevdk/go-flags/parser.go:333 +0x8e7
github.com/snapcore/snapd/vendor/github.com/jessevdk/go-flags.(*Parser).Parse(...)
 github.com/snapcore/snapd/vendor/github.com/jessevdk/go-flags/parser.go:190
main.run(0xc0002a5de0, 0xe)
 github.com/snapcore/snapd/cmd/snap/main.go:515 +0xa7
main.main()
 github.com/snapcore/snapd/cmd/snap/main.go:482 +0x371
ihor@ihor-dell:~$

Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

I switched to uk_UA.UTF-8 and was able to reproduce this problem. The panic happens when download is finishes.

Changed in snapd (Ubuntu):
status: Incomplete → Confirmed
assignee: nobody → Maciej Borzecki (maciek-borzecki)
Changed in snapd (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

I think this translation is what caused this: https://translations.launchpad.net/ubuntu/focal/+source/snapd/+pots/snappy/uk/666/+translate

The code has a hint about expected translation:

> TRANSLATORS: this needs to be a single rune that is understood to mean "minutes" in e.g. 1m30s

We currently have хв (2 runes), there's some proposals to use м.

@anprok would you be willing to look into updating the translation?

In the meantinme, what snap does is a bug, and I'll be sending a patch for that shortly.

Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :
Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

The fix has landed and should be in snapd from edge in a day or so.

Changed in snapd (Ubuntu):
status: In Progress → Fix Committed
Changed in snapd (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.