superfile: Getting "Terminal size too small" error when trying to open `spf` from `/tmp` directory

Bug

When I run spf from /tmp directory it just shows a small dialog box saying “Terminal size is too small”, and points out the required dimensions. But my terminal is already maximized.

Image

Please watch the following video:

https://www.loom.com/share/bf09a107eab344d0a62efcd80aa4b0a1?sid=babd03b8-252d-4c40-8d85-cc80dec03033

  • The issue is not terminal specific. The same issue occurs in Wezterm too.

Steps to reproduce

  • Install using bash -c "$(curl -sLo- https://superfile.netlify.app/install.sh)" and deny sudo privileges
  • Go to /tmp directory
  • Run spf

OS Info

  • OS: macOs Sequoia 15.3
  • superfile version: v1.1.7.1
  • Ghostty: Ghostty 1.1.0
  • Wezterm: wezterm 20250103-121535-8e9cf912
  • Shell: fish shell

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 31 (1 by maintainers)

Most upvoted comments

@yedhink “underlying issue ought to be fixed in a separate PR” - Yes. This is just a stop gap fix.

"Also, please note that, we need to make the directory listing logic a background job rather than it holding up the main thread " - Yes. Its not already implemented. It should be implemented

“I would also recommend taking inspiration from Yazi where they have implemented chunked directory listing” - Sounds interesting, will check it out. Thanks.

Ideally, the application should display a “Loading…” message during file loading to keep the user informed that the program is actively processing, ensuring that they don’t mistakenly believe the program has frozen.

However, as a temporary solution, I believe we could implement a feature where, for directories containing more than 10,000 files, superfile would display a message such as “Directory contains over 10k files, superfile does not support display at this time,” or something similar.

This would help avoid situations where the program becomes unresponsive, while still providing clear feedback to the user about the limitation.

I would still go through the code, and try to fix it.

Do let me know if you need any more info from my end. I will update here in a week if the issue reoccurs.

I tried to see if bubbletea framework is causing the issue by running the following code:

package main

import (
    "fmt"
    "github.com/charmbracelet/bubbletea"
)

type model struct {
    width  int
    height int
}

func (m model) Init() tea.Cmd {
    return nil
}

func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
    switch msg := msg.(type) {
    case tea.KeyMsg:
        if msg.String() == "q" {
            return m, tea.Quit
        }
    case tea.WindowSizeMsg:
        fmt.Printf("Terminal resized: width=%d, height=%d\n", msg.Width, msg.Height)
        m.width = msg.Width
        m.height = msg.Height
    case tea.QuitMsg:
        // Handle Ctrl+C or other quit signals
        fmt.Println("Exiting...")
        return m, tea.Quit
    }
    return m, nil
}

func (m model) View() string {
    return fmt.Sprintf("Width: %d, Height: %d\nPress 'q' to quit.", m.width, m.height)
}

func main() {
    p := tea.NewProgram(model{})
    if _, err := p.Run(); err != nil {
        fmt.Println("Error:", err)
    }
}

And it worked as intended in /tmp.

Issue is specific to exact path /tmp

PS: Opening spf from a nested directory within /tmp, like say /tmp/spf works.

Please watch this video: https://www.loom.com/share/6d555013937f49ea86c2b9910068f57c?sid=46ca479a-23e4-4f94-81f2-48292ecc80c1

Also, moving back to /tmp from /tmp/spf from within spf causes the application to get stuck - meaning I can’t do anything once I try to go to /tmp.

@lazysegtree Lemme know if you need any further info.

Logs when opening and quitting in non-temp directory

time=2025-02-04T15:44:43.310+05:30 level=DEBUG msg="Runtime information" runtime.GOOS=darwin "start directory"=/Users/ikigai/dev/external-repos/superfile
time=2025-02-04T15:44:43.310+05:30 level=INFO msg="Error parsing pinned data unexpected end of JSON input\n"
time=2025-02-04T15:44:43.310+05:30 level=DEBUG msg="" h=0 w=0
time=2025-02-04T15:44:43.311+05:30 level=INFO msg="Error parsing pinned data unexpected end of JSON input\n"
time=2025-02-04T15:44:43.314+05:30 level=DEBUG msg="" h=0 w=0
time=2025-02-04T15:44:43.314+05:30 level=INFO msg="Error parsing pinned data unexpected end of JSON input\n"
time=2025-02-04T15:44:43.316+05:30 level=DEBUG msg="" h=0 w=0
time=2025-02-04T15:44:43.317+05:30 level=DEBUG msg=handleWindowResize w=144 h=40
time=2025-02-04T15:44:43.317+05:30 level=INFO msg="Error parsing pinned data unexpected end of JSON input\n"
time=2025-02-04T15:44:43.319+05:30 level=DEBUG msg="" h=40 w=144
time=2025-02-04T15:44:43.474+05:30 level=INFO msg="Error parsing pinned data unexpected end of JSON input\n"
time=2025-02-04T15:44:43.480+05:30 level=DEBUG msg="" h=40 w=144
time=2025-02-04T15:44:44.752+05:30 level=DEBUG msg=model.handleKeyInput msg=q typestr=runes runes=[113] type=-1 paste=false alt=false
time=2025-02-04T15:44:44.752+05:30 level=DEBUG msg="model.handleKeyInput. model info. " filePanelFocusIndex=0 filePanel.focusType=focus filePanel.panelMode=browserMode typingModal.open=false warnModal.open=false fileModel.renaming=false searchBar.focussed=false helpMenu.open=false firstTextInput=false focusPanel=nonePanelFocus
time=2025-02-04T15:44:44.752+05:30 level=DEBUG msg="Quitting superfile" "current dir"=/Users/ikigai/dev/external-repos/superfile
time=2025-02-04T15:44:44.753+05:30 level=INFO msg="Error parsing pinned data unexpected end of JSON input\n"
time=2025-02-04T15:44:44.760+05:30 level=DEBUG msg="" h=40 w=144
time=2025-02-04T15:44:44.766+05:30 level=DEBUG msg="" h=40 w=144

Logs when opening in /tmp directory - not able to quit the app

time=2025-02-04T15:46:00.222+05:30 level=DEBUG msg="Runtime information" runtime.GOOS=darwin "start directory"=/tmp
time=2025-02-04T15:46:00.224+05:30 level=INFO msg="Error parsing pinned data unexpected end of JSON input\n"
time=2025-02-04T15:46:00.225+05:30 level=DEBUG msg="" h=0 w=0
time=2025-02-04T15:46:00.225+05:30 level=DEBUG msg=handleWindowResize w=144 h=40
time=2025-02-04T15:46:00.225+05:30 level=INFO msg="Error parsing pinned data unexpected end of JSON input\n"

Also try to press some keys when you are stuck on the “terminal size too small” screen. I want to know if that would trigger any Update() calls with your keystrokes or not, and if that would trigger any subsequent View() calls.

Did that. No new logs are getting appended once terminalSizeWarnRender is shown on screen. Also, like I had mentioned before, we cannot exit out of spf when on this warning screen - have to kill it using pid of currently running spf.

Issue is only in /tmp directory

I tried running spf from /usr, /etc(symlinked to /private/etc), /var(symlinked to /private/var) and other directories where usually an executable runs into permission issues - but none of these directories caused an issue - spf worked as intended.

Only in /tmp and /private/tmp this issue occurs. Between /tmp is a symlink to /private/tmp : https://apple.stackexchange.com/questions/1043/why-is-tmp-a-symlink-to-private-tmp