Skip to content

Backtrace and runtime error when opening binary files #1225

@Maickii

Description

@Maickii

Now, obviously there is no point in opening binary files. However, that's not an excuse to giving a backtrace. micro should never give a backtrace error or a runtime error. If a fix will take some time, I suggest temporarily submitting a short term fix that will scan the file and determine if a file is a binary file (the command file may be used in linux, I dont know about other platforms) and then ask the user if they want to proceed then continue as normal and obviously fail miserably with a backtrace. Another option is to simply refuse to open binary files until this is fixed with an error saying binary files are not yet supported. Actually, now that I think about it, who needs to modify binary files anyway? This could be the permanent solution.

Here is a sample binary that fails

michael@Michael:micro$ micro /bin/bash
Micro encountered an error: runtime error: index out of range
runtime.errorString runtime error: index out of range
/home/zbyedidia/go/src/runtime/panic.go:491 (0x42bbc3)
/home/zbyedidia/go/src/runtime/panic.go:28 (0x42a89e)
/home/zbyedidia/gopath/src/github.com/zyedidia/micro/cmd/micro/cellview.go:171 (0x8b113f)
/home/zbyedidia/gopath/src/github.com/zyedidia/micro/cmd/micro/view.go:843 (0x913e15)
/home/zbyedidia/gopath/src/github.com/zyedidia/micro/cmd/micro/view.go:1097 (0x916469)
/home/zbyedidia/gopath/src/github.com/zyedidia/micro/cmd/micro/micro.go:240 (0x8d63c6)
/home/zbyedidia/gopath/src/github.com/zyedidia/micro/cmd/micro/micro.go:491 (0x8d7f3a)
/home/zbyedidia/go/src/runtime/proc.go:185 (0x42d9cd)
/home/zbyedidia/go/src/runtime/asm_amd64.s:2337 (0x45acc1)

You can use micro -version to get the commit hash.
Version: 1.4.1
Commit hash: 1856891
Compiled on August 10, 2018

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions