starship icon indicating copy to clipboard operation
starship copied to clipboard

Autofs: key map gone wrong

Open gsacre opened this issue 2 years ago β€’ 2 comments

Current Behavior

When using autofs with a custom script, starship gives autofs paths that autofs uses to insert to the automount path. For more information: reddit

Expected Behavior

No path should be given to autofs when using starship.

Additional context/Screenshots

Here is my configuration:

/etc/auto.master:

/mnt/sauron /etc/auto.sauron --timeout 60

/etc/auto.sauron:

#!/bin/bash

key="$1"

ping -c 1 -W 2 10.0.20.5 >/dev/null 2>/dev/null
is_host_alive=$?

if [ $is_host_alive -eq 0 ]; then
    echo "-fstype=nfs4,retry=0,timeo=60,hard,intr,tcp 10.0.20.5:/data/Photos \\"
fi

When entering /mnt/sauron, I have the following:

/mnt/sauronπŸ”’ 
❯ ls
build.gradle   commondir       meson.build    pom.xml          setup.cfg
Cargo.toml    composer.json  mix.exs           Project.toml     v.mod
Chart.yaml    HEAD               package.json  pyproject.toml  vpkg.json

This is linked to starship given that when I use plain bash, it works as expected.

Possible Solution

None that I know :-) For my problem, I filter all those for my target directory and now it works.

Environment

  • Starship version: 0.57.0
  • bash version: GNU bash, version 5.1.16(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

  • Operating system: Fedora 36
  • Terminal emulator:
  • Git Commit Hash: f03c0825
  • Branch/Tag: v0.57.0
  • Rust Version: rustc 1.54.0 (a178d0322 2021-07-26)
  • Rust channel: release
  • Build Time: 2021-08-26 14:15:15 +00:00

Relevant Shell Configuration

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
source ~/.alias
eval $(thefuck --alias)
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export MARKER_KEY_GET='\C-l'
[[ -s "$HOME/.local/share/marker/marker.sh" ]] && source "$HOME/.local/share/marker/marker.sh"

export EDITOR=vim

export PATH=$PATH:${HOME}/.config/composer/vendor/bin/:${HOME}/bin:${HOME}/.local/bin

eval "$(starship init bash)"

GOPATH=$HOME/git/go

Starship Configuration

<unknown config>

gsacre avatar Jun 08 '22 13:06 gsacre

As part of its operation, starship will attempt to open some files. In your case, it looks like your script will mount any file that starship attempts to open. To reduce the number of files opened, you can either try disabling the package module or switching to the latest version of starship.

davidkna avatar Jun 08 '22 14:06 davidkna

Hi @gsacre, we have implemented some fixes in the more recent versions of starship, is this still an issue with the most recent release?

andytom avatar Aug 19 '22 18:08 andytom

@gsacre I am going to close this issue as it should be resolved in the most recent versions of starship if this is not the case please feel free to reopen it.

andytom avatar May 01 '23 20:05 andytom