Coder Social home page Coder Social logo

lucaslarson / dotfiles Goto Github PK

View Code? Open in Web Editor NEW
123.0 5.0 19.0 4.44 MB

This is where the ♥️ is                                   at.

License: Other

Shell 93.35% Vim Script 0.15% Ruby 6.49%
dotfiles mackup lucaslarson zshrc zsh macos shell git-plugins zsh-plugins hacktoberfest

dotfiles's Introduction

dotfiles's People

Contributors

actions-user avatar dependabot[bot] avatar imgbot[bot] avatar lucaslarson avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dotfiles's Issues

consider 𝑥 >/dev/null 2>&1 instead of printf 𝑥

more specifically:
using

PS4_temporary=${PS4}
PS4=''
set -x; ! || done! >/dev/null 2>&1;set +x
PS4=${PS4_temporary}
unset PS4_temporary

# apk
command -v apk >/dev/null 2>&1 || (
# https://github.com/ish-app/ish/wiki/Installing-apk-on-the-App-Store-Version/89019508ddd504e6f08af30d8c8da2d3a8691b76#wiki-body
wget --output-document - http://web.archive.org/web/20201127185919id_/dl-cdn.alpinelinux.org/alpine/v3.12/main/x86/apk-tools-static-2.10.5-r1.apk | tar -xz apk.static
./apk.static add apk-tools
)
# configure repositories
printf 'http://dl-cdn.alpinelinux.org/alpine/latest-stable/main\n' >/etc/apk/repositories
printf 'http://dl-cdn.alpinelinux.org/alpine/latest-stable/community\n' >>/etc/apk/repositories
# update
printf '\nupdating Alpine Linux repositories...\n'
apk update --verbose --progress
apk upgrade --verbose --progress
# https://wiki.alpinelinux.org/w/index.php?oldid=17773&title=How_to_get_regular_stuff_working#Man_pages
# man-pages adds `man0`, `man2`, man4`, `man6` to `/usr/share/man/`
{ [ -d /usr/share/man/man0 ] &&
[ -d /usr/share/man/man2 ] &&
[ -d /usr/share/man/man4 ] &&
[ -d /usr/share/man/man6 ]; } || (
printf '\ninstalling man pages...\n'
apk add man-pages
)
command -v mandoc >/dev/null 2>&1 || (
printf '\ninstalling mandoc for man pages...\n'
apk add mandoc mandoc-doc
)
command -v less >/dev/null 2>&1 || (
printf '\ninstalling less to read man pages...\n'
apk add less less-doc
)
# https://wiki.alpinelinux.org/w/index.php?oldid=17773&title=How_to_get_regular_stuff_working#Shell_.40_commandline
# https://web.archive.org/web/20210218201739id_/web.archive.org/screenshot/docs.google.com/document/d/10-8wjANQGbG43XZ0wN57M1RYOLUwu9RZATNe9vJQYKw/mobilebasic
# https://wiki.alpinelinux.org/w/index.php?oldid=18038&title=Alpine_newbie_apk_packages#coreutils_libc_and_utmps_in_alpine
apk add coreutils coreutils-doc
{ [ -x /usr/bin/coreutils ] &&
[ findutils = "$($(command -v find) -version|head -n1|awk '{print $3}'|tr -d '()')" ]; } || (
printf '\ninstalling Linux utilities...\n'
)
apk add util-linux util-linux-doc pciutils pciutils-doc usbutils usbutils-doc coreutils coreutils-doc binutils binutils-doc findutils findutils-doc grep grep-doc wget wget-doc curl curl-doc openssl openssl-doc sudo sudo-doc sed sed-doc attr attr-doc dialog dialog-doc bash bash-doc bash-completion bash-completion-doc readline readline-doc
{
printf 'http://dl-cdn.alpinelinux.org/alpine/edge/main\n';
printf 'http://dl-cdn.alpinelinux.org/alpine/edge/community\n';
printf 'http://dl-cdn.alpinelinux.org/alpine/edge/testing\n';
} >>/etc/apk/repositories
apk update
# ssh
# https://wiki.alpinelinux.org/w/index.php?oldid=13842&title=Setting_up_a_ssh-server#OpenSSH
[ -d /etc/ssh ] || (
printf '\ninstalling OpenSSH...\n'
apk add openssh openssh-doc
)
# https://wiki.alpinelinux.org/w/index.php?oldid=17295&title=Setting_up_a_laptop#Creating_GPG_keys
[ -x /usr/bin/gpg2 ] || (
apk add gnupg gnupg-doc
)
# git
command -v git >/dev/null 2>&1 || (
printf '\ninstalling Git...\n'
apk add git git-doc
)
# git add --patch
[ -x /usr/libexec/git-core/git-add--interactive ] || (
# https://stackoverflow.com/a/57632778
apk add git-perl
)
# time zone
printf '\nupdating time zone information...\n'
apk add --no-cache tzdata tzdata-doc
cp /usr/share/zoneinfo/America/New_York /etc/localtime
printf 'America/New_York\n' >/etc/timezone
# python
printf '\nchecking Python installation...\n'
command -v python >/dev/null 2>&1 || (
printf '\ninstalling Python 2 and Python 3...\n'
apk add python2 python2-doc python3 python3-doc
)
# pip
command -v pip >/dev/null 2>&1 || (
printf '\ninstalling pip...\n' && sleep 3
printf 'this may take a while...\n'
curl http://web.archive.org/web/20201031072740id_/bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
)
# mackup
command -v mackup >/dev/null 2>&1 || (
printf '\ninstalling mackup...\n'
pip install --upgrade mackup
)
# zsh
command -v zsh >/dev/null 2>&1 || (
printf '\ninstalling Zsh...\n'
apk add zsh zsh-doc
)
# chsh
# part of shadow on Alpine Linux
command -v chsh >/dev/null 2>&1 || (
apk add shadow shadow-doc
)
# Oh My Zsh
command -v omz >/dev/null 2>&1 || [ -d "${HOME}/.oh-my-zsh" ] || (
printf 'installing Oh My Zsh...\n'
sh -c "$(wget http://web.archive.org/web/20201211072817id_/raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh --output-document -)" "" --unattended --keep-zshrc
)
# update, repair everything again before close
printf '\nupdating...\n'
apk update --verbose --progress
printf '\nupgrading...\n'
apk upgrade --verbose --progress
printf '\nrepairing and resolving dependencies...\n'
apk fix --verbose --verbose --depends --progress
printf '\nverifying installations...\n'
apk verify --verbose --verbose --progress && printf 'verified.\n'
command -v pip >/dev/null 2>&1 && (
printf '\nupdating Python\xe2\x80\x99s package manager...\n'
python3 -m pip install --upgrade pip
)
# cleanup
printf '\n\ncleaning up temporary installation files and performing housekeeping...\n'
[ -w apk.static ] && rm apk.static
[ -w get-pip.py ] && rm get-pip.py
[ -w setup ] && rm setup
# message of the day
[ -e /etc/motd.bak ] || cp /etc/motd /etc/motd.bak
printf '' >/etc/motd
# delete thumbnail cache files
find -- . -type f \( \
-name '.DS_Store' -or \
-name 'Desktop.ini' -or \
-name 'Thumbs.db' -or \
-name 'desktop.ini' -or \
-name 'thumbs.db' \
\) \
-delete
# delete empty, writable, zero-length files
# except those within `.git/` directories
# and those with specific names
# https://stackoverflow.com/a/64863398
find -- . -type f -writable -size 0 \( \
-not -path '*.git/*' -and \
-not -name "$(printf 'Icon\xd\xa')" -and \
-not -name '*LOCK' -and \
-not -name '*empty*' -and \
-not -name '*hushlogin' -and \
-not -name '*ignore' -and \
-not -name '*journal' -and \
-not -name '*lock' -and \
-not -name '*lockfile' -and \
-not -name '.dirstamp' -and \
-not -name '.gitkeep' -and \
-not -name '.gitmodules' -and \
-not -name '.keep' -and \
-not -name '.sudo_as_admin_successful' -and \
-not -name '.watchmanconfig' -and \
-not -name '__init__.py' -and \
-not -name 'favicon.*' \
\) \
-delete
# delete empty directories recursively
# but skip Git-specific and `/.well-known/` directories
# https://stackoverflow.com/q/4210042#comment38334264_4210072
find -- . -type d -empty \( \
-not -path '*.git/*' -and \
-not -name '.well-known' \
\) \
-delete
# done
printf '\ninitialization complete\n'
sleep 0.5
printf '\nrestarting...\n'
sleep 1
printf '\ndone!\n'
exit

enable tab completion for SSH hostnames

# add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
# https://github.com/mathiasbynens/dotfiles/commit/fecb8c6
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh

for consideration: submodule for package versus package

note to self; context for consideration:

Having seen that I comprise half of zdharma-continuum/zsh-diff-so-fancy’s stargazers, I felt prompted to replace the plugin with the applicable npm package as was done with git-open (802072a92a)

On the other hand, if I move a package from $DOTFILES/.gitmodules (and $DOTFILES/custom/plugins into $(npm config get prefix --global)/bin, then Dependabot will no longer keep nudging me to update.


  • Would it not be preferable to have Dependabot keep everything updated? (Noting that without symlinking and using npm in ways it’s not meant to be used, there’s no way to create a package.json and package-lock.json)

`${SHELL##*/}` depends on user configuration; `${0##*[-/]}` does not

The scripts below appear shell-agnostic, but if running them using Bash on a system whose ${SHELL} is Zsh, they don’t work at all.

For example, instead of:

. "${HOME}/.${SHELL##*/}rc" && exec "${SHELL##*/}" --login

we should use:

. "${HOME}/.${0##*[-/]}rc" && exec "${0##*[-/]}" --login

alias aliases='${EDITOR:-vi} ${ZSH:-${HOME}/.oh-my-${SHELL##*/}}/custom/aliases.${SHELL##*/}; . ${HOME}/.${SHELL##*/}rc && exec ${SHELL##*/} --login'
alias ohmyzsh='cd ${ZSH:-${HOME}/.oh-my-${SHELL##*/}}'
alias zshconfig='${EDITOR:-vi} ${HOME}/.${SHELL##*/}rc; . ${HOME}/.${SHELL##*/}rc && exec ${SHELL##*/} --login'
alias zshenv='${EDITOR:-vi} ${HOME}/.${SHELL##*/}env; . ${HOME}/.${SHELL##*/}rc && exec ${SHELL##*/} --login'
alias zshrc='${SHELL##*/}config'

add function-scope preference for unescaped pathnames

show unescaped pathnames where git is already serving human-friendly content

  • add -c quotePath=false where git command to target audience-human output instead of git status where scripting is not possible or likely

Where git config allows for scope-wide preference for escaping “unusual[ly]”1 named paths,2 the same functionality is available on a per-invocation level,3 which allows for temporary syntactic sugar without blindingly blunted defaults (the default behavior is to escape and quote such content, which is the safest and most reasonable default, especially in situations where a machine or other third party might parse the output).

To that end, in the instances where this repository calls for a function-scope -c color.status=always, it should call also for unescaped pathnames -c core.quotePath=false.


Footnotes

  1. scare quotes in original4

  2. git config core.quotePath=false

  3. git -c core.quotePath=false status, for example, instead of git status

  4. https://github.com/git/git/commit/9378c16135

assigning an alias (`cd -`) to `-` is not portable

An alias whose name begins with - or + is not entirely portable.

  • Zsh ≤5.9.0.1-dev chokes1 on aliases whose names begin with - or + unless the assignment includes an end-of-options delimiter:2 alias -='cd -' fails but alias -- -='cd -'3 works as expected
  • contrariwise, Busybox on Alpine Linux4 chokes on alias -- -='cd -', but alias -='cd -' works as expected

Footnotes

  1. https://github.com/LucasLarson/dotfiles/blob/85bdd324fc76c11fb39fd53739c2eaf48b56cf85/custom/aliases.zsh#L79-L86

  2. According to a part of the Zsh FAQ that hasn’t changed since 1999 or earlier, “To begin a zsh alias with a - (dash, hyphen) character, use alias --: . . . alias -- -"=fg %-"

  3. ohmyzsh/ohmyzsh@60e99779d5

  4. Alpine Linux v3.16 appears to run Busybox 1.35.0 (thanks, repology)

non-portable, non-POSIX-compliant `sed` call

changing the default shell with sed -E -i is:

  • not portable,
    and it is
  • not POSIX-compliant

and the current replacement does:

  • not account for distributions where the default shell is dash like Ubuntu and Debian, but that is fine, because while /bin/dash is run, it a symlink to /bin/dash, located at /bin/sh, which is called, and which this solution does replace

command sed -E -i -e "s|/bin/b?a?sh$|$(command -v -- zsh)|" '/etc/passwd'

A variation of the formula appears in CodeSnippets.md:

dotfiles/CodeSnippets.md

Lines 533 to 540 in cc50d8e

find -- . -type f -exec sed -E -i \
-e '/\/bin\/b?a?sh/{' \
-e 's//\/usr\/bin\/env zsh/' \
-e ':a' \
-e '$! N' \
-e '$! b a' \
-e '}' \
'{}' ';'

The current solution to change /etc/passwd’s entries containing /bin/sh, /bin/bash, or /bin/ash, to wherever zsh is installed, is broken without proprietary extensions1 – marked “❗️” – to POSIX sed:2

# https://github.com/LucasLarson/dotfiles/blob/cc50d8e6da/setup/init.sh#L346
#                     ╭──────────────────── ❗️ extended regex
#                     │  ╭───────────────── ❗️ modify files in-place
#                     │  │  ╭────────────── expression incoming
#                     │  │  │  ╭─────────── search for
#                     │  │  │  │       ╭─┬─ ❗️ using `?`, more properly `\?`, to
#                     │  │  │  │       │ │  mean “0 or 1” is a GNU extension
         command sed -E -i -e "s|/bin/b?a?sh$|$(command -v -- zsh)|" '/etc/passwd'
#                               │╰────────┬─╯│╰─┬────────────────╯│   ╰─┬───────╯
#    ╭──────────────────────────╯         ╰─╮╰╮ │ ╭───────────────╯     │
#    ╰─ search for what’s between here and  │ │ │ │ ╭───────────────────╯
#                             the next `|`  │ │ │ │ │
# any line ending (`$`) in any of`/bin/sh` ─╯ │ │ │ │
#      `/bin/bash`, `/bin/bsh`, `/bin/ash`    │ │ │ │
#    replace with everything from this `|` ───╯ │ │ │
#                          to the last `|`      │ │ │
#  the Z shell binary’s location, which is ─────╯ │ │
#    probably `/bin/zsh` or `/usr/bin/zsh`        │ │
#          replacement expression complete ───────╯ │
#             file with content to replace ─────────╯

Footnotes

  1. gnu.org/s/sed/manual/html_node/BRE-syntax § \?

  2. opengroup.org/onlinepubs/9699919799/utilities/sed.html § Regular Expressions in sed

is `git log` alias `git log` better implemented by @ohmyzsh than @gggritso?

# git log
# https://github.com/gggritso/gggritso.com/blob/a07b620/_posts/2015-08-23-human-git-aliases.md#readme
alias glog="git log --graph --branches --remotes --tags --format=format:'%Cgreen%h %Creset• %<(75,trunc)%s (%cN, %cr) %Cred%d' --date-order"

would @ohmyzsh’s
git log --oneline --decorate --graph¹

serve better than @gggritso’s
git log --graph --branches --remotes --tags --format=format:'%Cgreen%h %Creset• %<(75,trunc)%s (%cN, %cr) %Cred%d' --date-order"²


  1. https://github.com/ohmyzsh/ohmyzsh/blob/d853ec4b629f24c6622f414f312fbf83cec0990d/plugins/git/git.plugin.zsh#L157
  2. https://github.com/gggritso/gggritso.com/blob/a07b620/_posts/2015-08-23-human-git-aliases.md#readme

stackoverrun.com appears down

[✖] https://stackoverrun.com/ja/q/12834672 → Status: 0 Error: ESOCKETTIMEDOUT
at ClientRequest. (/usr/local/lib/node_modules/markdown-link-check/node_modules/request/request.js:816:19)
“apk add composer'を試みているDockerfileが失敗していますか?”

stackoverrun.com › ... - Translate this page
作曲-1.5.2-R0:でマスク:(!恐ろしく時代遅れ). を@​testingそれはDockerfile 固定テストリポジトリというの作者と思われるので、あなたが @​testing を追加 ...
1 answer

stackoverrun.com appears down

[✖] https://stackoverrun.com/ja/q/12834672 → Status: 0 Error: ESOCKETTIMEDOUT
at ClientRequest. (/usr/local/lib/node_modules/markdown-link-check/node_modules/request/request.js:816:19)
“apk add composer'を試みているDockerfileが失敗していますか?”

stackoverrun.com › ... - Translate this page
作曲-1.5.2-R0:でマスク:(!恐ろしく時代遅れ). を@​testingそれはDockerfile 固定テストリポジトリというの作者と思われるので、あなたが @​testing を追加 ...
1 answer

remove access to discontinued OpenAI models

remove Zsh codex while there’s no obvious code-completion successor:

OpenAI has discontinued code-davinci models:

On March 23rd, we will discontinue support for the Codex API. All customers will have to transition to a different model. Codex was initially introduced as a free limited beta in 2021, and has maintained that status to date. Given the advancements of our newest GPT-3.5 models for coding tasks, we will no longer be supporting Codex and encourage all customers to transition to GPT-3.5-Turbo.

On March 23rd, we will discontinue support for the Codex API. All customers will have to transition to a different model. Codex was initially introduced as a free limited beta in 2021, and has maintained that status to date. Given the advancements of our newest GPT-3.5 models for coding tasks, we will no longer be supporting Codex and encourage all customers to transition to GPT-3.5-Turbo.

Models affected
The following models will be discontinued:

code-cushman:001
code-cushman:002
code-davinci:001
code-davinci:002

We understand this transition may be temporarily inconvenient, but we are confident it will allow us to increase our investment in our latest and most capable models.

Originally posted by @oyale in tom-doerr/zsh_codex#16 (comment)

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/jsonlint.yml
  • actions/checkout v4
  • peter-evans/create-pull-request v6
.github/workflows/shellcheck-markdown.yml
  • actions/checkout v4
.github/workflows/super-linter.yml
  • actions/checkout v4
  • github/super-linter v5.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

surround with single quotes instead of double for shfmt compliance?

alias mu=" \
cd ${DOTFILES:-${HOME}/Dropbox/dotfiles} && \
garbage && \
mackup backup --force --root && \
git fetch --all && \
git submodule update --init --recursive && \
git status"
alias mux=" \
cd ${DOTFILES:-${HOME}/Dropbox/dotfiles} && \
garbage && \
mackup backup --force --root --verbose && \
git fetch --all --verbose && \
git submodule update --init --recursive --remote && \
git status"

include crufty `.zcompdump` files in `cleanup`

this part of the cleanup function should add a line

-name '.zcompdump-*' or \

to remove cruftily named .zcompdump files such as .zcompdump-oin-5.4.2 or .zcompdump-LPhoneXSMax-5.8.

# delete thumbnail cache files
find -- . -type f \( \
-name '.DS_Store' -or \
-name 'Desktop.ini' -or \
-name 'desktop.ini' -or \
-name 'Thumbs.db' -or \
-name 'thumbs.db' \
\) \
$verbose -delete

remove archival material from the version-control system

Korn shell invocation clears `$HISTFILE`

invoking Korn shell with ksh or ksh93 and granting Korn shell access to $SHELL’s $HISTFILE can corrupt or destroy $HISTFILE.

I’m unable to create a reproducible example.

find alias to delete merged Git branches

# remove branches already merged into default branch
# https://github.com/mathiasbynens/dotfiles/commit/6c16e6b
alias gDM="!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"

⚠️ gdm is set to git diff <default branch>

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

hardcoded references to `edit` will break

edit is not at all portable here:

alias aliases='edit ${ZSH:-${HOME}/.oh-my-${SHELL##*/}}/custom/aliases.${SHELL##*/}; . ${HOME}/.${SHELL##*/}rc && exec ${SHELL##*/} --login'
alias ohmyzsh='cd ${ZSH:-${HOME}/.oh-my-${SHELL##*/}}'
alias zshconfig='edit ${HOME}/.${SHELL##*/}rc; . ${HOME}/.${SHELL##*/}rc && exec ${SHELL##*/} --login'
alias zshenv='edit ${HOME}/.${SHELL##*/}env; . ${HOME}/.${SHELL##*/}rc && exec ${SHELL##*/} --login'

A solution like ${EDITOR:-vi}¹ instead of edit² is portable and should replace it.


  1. this may not be the correct if-not-𝑥-then-𝑦 syntax when calling a binary like /usr/bin/vi, but it’s close
  2. edit is defined as:

    dotfiles/.zshenv

    Lines 8 to 20 in 9c37ff8

    if command -v nvim > /dev/null 2>&1; then
    EDITOR="nvim"
    elif command -v vim > /dev/null 2>&1; then
    EDITOR="vim"
    elif command -v vi > /dev/null 2>&1; then
    EDITOR="vi"
    else
    EDITOR="nano"
    fi
    export EDITOR
    # https://github.com/koalaman/shellcheck/wiki/SC2139/db553bf16fcb86b2cdc77b835e75b9121eacc429#this-expands-when-defined-not-when-used-consider-escaping
    alias editor='$EDITOR'
    alias edit="editor"

WS-2019-0379 (Medium) detected in commons-codec-1.10.jar

WS-2019-0379 - Medium Severity Vulnerability

Vulnerable Library - commons-codec-1.10.jar

The Apache Commons Codec package contains simple encoder and decoders for various formats such as Base64 and Hexadecimal. In addition to these widely used encoders and decoders, the codec package also maintains a collection of phonetic encoding utilities.

Path to vulnerable library: /dotfiles/Library/Application Support/PyCharm2019.3/datalore-intellij-plugin/lib/commons-codec-1.10.jar

Dependency Hierarchy:

  • commons-codec-1.10.jar (Vulnerable Library)

Found in HEAD commit: 6b2f9295e9052a76034fb8cf630271b237f4ac7c

Vulnerability Details

Apache commons-codec before version “commons-codec-1.13-RC1” is vulnerable to information disclosure due to Improper Input validation.

Publish Date: 2019-05-20

URL: WS-2019-0379

CVSS 3 Score Details (6.5)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: apache/commons-codec@48b6157

Release Date: 2019-05-12

Fix Resolution: 1.13-RC1


Step up your Open Source Security Game with WhiteSource here

`${HOME%/}` instead of `${HOME-}`

Consider upgrading ${HOME-} references1 to ${HOME%/}2 to avoid $PATH pollution.3

Footnotes

  1. search: repo:LucasLarson/dotfiles /\$\{HOME-\}/

  2. BashPitfalls § 28

  3. The Single UNIX Specification, version 4,4 says that “[i]f a pathname begins with two successive slash characters, the first component following the leading slash characters may be interpreted in an implementation-defined manner” (via)

  4. Single UNIX Specification, Version 4: Base Definitions § 4.13 Pathname Resolution

`~/.local/bin` is added to `$PATH` twice

  1. from 0b2d044dd4, 2021-02-25:

    dotfiles/.zshrc

    Lines 20 to 24 in 913708d

    # set PATH so it includes applicable private `bin`s
    test -d "${HOME-}"'/bin' &&
    PATH="${HOME-}"'/bin'"${PATH:+:${PATH-}}"
    test -d "${HOME-}"'/.local/bin' &&
    PATH="${HOME-}"'/.local/bin'"${PATH:+:${PATH-}}"

  2. from c66f3bcefd, 2020-12-26:

    dotfiles/.zshrc

    Lines 346 to 348 in 913708d

    # location of Python packages on Linux
    test -d "${HOME-}"'/.local/bin' &&
    PATH="${HOME-}"'/.local/bin'"${PATH:+:${PATH-}}"

is `PATH` `coreutils` constructed safely?

if not, then consider:¹

command -v brew >/dev/null 2>&1 &&
[ -d "$(brew --prefix coreutils)" ] &&
PATH="$(brew --prefix coreutils)/libexec/gnubin:${PATH}" &&
export PATH
"$(brew --prefix)" "$(brew --prefix coreutils)"
macOS Intel /usr/local² /usr/local/opt/coreutils
ARM /opt/homebrew² /opt/homebrew/opt/coreutils
Linux /home/linuxbrew/.linuxbrew² /home/linuxbrew/.linuxbrew/opt/homebrew

  1. driesvints/dotfiles@388baf1/path.zsh#L17
  2. https://github.com/Homebrew/brew/blob/c65d461/docs/Manpage.md#--prefix-formula

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.