Sublime Forum

Sublime Merge changes file permissions on "Discard"

#1

CentOS 8, nginx

Sublime Merge changes file permissions, how can i fix it?

=== App Version Information ===
Build: 2009

=== Git Version Information ===
Using Git: git (system)
git version 2.18.2
PATH: /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin

=== Browse Page Information ===
HEAD: 73606c9baa72ebfd2b3b6c7af1d8a8306e88cc3c
Is in merge: 0
Is in cherry_pick: 0
Is in rebase: 0
Is in revert: 0

=== Git Status Information ===

=== Our Status Information ===

=== Git Config Information ===
branch.labo-v3.merge=refs/heads/labo-v3
branch.labo-v3.remote=origin
branch.master.merge=refs/heads/master
branch.master.remote=origin
core.bare=false
core.filemode=false
core.logallrefupdates=true
core.repositoryformatversion=0
credential.helper=store
diff.guitool=kdiff3
diff.tool=kdiff3
difftool.kdiff3.path=/usr/bin/kdiff3
difftool.kdiff3.trustexitcode=false
difftool.prompt=false
filesystem.Oracle Corporation|14|/dev/mapper/cl-root.minracythreshold=1503 microseconds
filesystem.Oracle Corporation|14|/dev/mapper/cl-root.timestampresolution=8000 nanoseconds
merge.tool=kdiff3
mergetool.kdiff3.path=/usr/bin/kdiff3
mergetool.kdiff3.trusexitcode=false
mergetool.prompt=false
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
remote.origin.url=https://github.com/marcari-admin/marcari-platform.git
user.email=anh.tung@primelabo.com.vn
user.name=Anh Tung

=== Our Config Information ===
Git Config Path Information
Using config path: /etc/gitconfig
Using config path: /home/tungxen/.config/git/config
Using config path: /home/tungxen/.gitconfig
Using config path: /home/tungxen/workspace/marcari-platform/.git/config

Our config output is identical to the Git config output

=== Git Attributes Information ===
git check_attr --all output

=== Our Modified Files Newline Normalisation and EOL Information ===

0 Likes

#2

The “Discard” button simply runs git checkout $file. Can you confirm that doing git checkout index.php has the same behavior on the command line? If so this is a problem with your git configuration.

0 Likes

#3

Tools > Show Console
Executing: git checkout – public/index.php
Working dir: /home/tungxen/workspace/marcari-platform
Env vars: GIT_EDITOR=/bin/true GIT_PAGER=cat
Result: success

delete file index.php and create again by sublime text 3
-rw-r--r-- 1 tungxen tungxen 1980 Apr 22 07:16 index.php

edit file index.php

  1. run in terminal
    open terminal run git checkout -- public/index.php result
    -rw-rw-r-- 1 tungxen tungxen 1980 Apr 22 07:22 index.php
    -rw-r–r-- => -rw-rw-r– ? It’s not right but It’s okay
  2. click button “Discard”
    -rw------- 1 tungxen tungxen 1980 Apr 22 07:24 index.php
    -rw-r–r-- => -rw------- ? why
0 Likes

#4

That is very odd. Your debug info says we’re using the system git, so there shouldn’t be any difference between running checkout from the command line to us execing checkout. Do you have any git hooks?

0 Likes

#5

i dont know git hooks. never use it before.

  1. open terminal run: git clone https://github.com/...
    [tungxen@localhost marcari-platform]$ ls -l
    total 672
    drwxrwxr-x 12 tungxen tungxen 199 Apr 22 08:45 app
    -rw-rw-r-- 1 tungxen tungxen 1686 Apr 22 08:45 artisan
    drwxrwxr-x 3 tungxen tungxen 34 Apr 22 08:45 bootstrap
    -rw-rw-r-- 1 tungxen tungxen 1803 Apr 22 08:45 composer.json
    -rw-rw-r-- 1 tungxen tungxen 218208 Apr 22 08:45 composer.lock
    drwxrwxr-x 3 tungxen tungxen 309 Apr 22 08:45 config
    drwxrwxr-x 8 tungxen tungxen 117 Apr 22 08:45 database
    -rw-rw-r-- 1 tungxen tungxen 1256 Apr 22 08:45 package.json
    -rw-rw-r-- 1 tungxen tungxen 430667 Apr 22 08:45 package-lock.json
    -rw-rw-r-- 1 tungxen tungxen 1669 Apr 22 08:45 phpunit.xml
    drwxrwxr-x 7 tungxen tungxen 195 Apr 22 08:45 public
    -rw-rw-r-- 1 tungxen tungxen 4198 Apr 22 08:45 readme.md
    drwxrwxr-x 6 tungxen tungxen 53 Apr 22 08:45 resources
    drwxrwxr-x 2 tungxen tungxen 75 Apr 22 08:45 routes
    -rw-rw-r-- 1 tungxen tungxen 563 Apr 22 08:45 server.php
    drwxrwxr-x 5 tungxen tungxen 47 Apr 22 08:45 storage
    drwxrwxr-x 4 tungxen tungxen 104 Apr 22 08:45 tests
    -rw-rw-r-- 1 tungxen tungxen 554 Apr 22 08:45 webpack.mix.js

  2. sublime merge > File > Clone Repository (input source Url https://github.com/…)
    [tungxen@localhost marcari-platform2]$ ls -l
    total 672
    drwx------ 12 tungxen tungxen 199 Apr 22 09:04 app
    -rw------- 1 tungxen tungxen 1686 Apr 22 09:04 artisan
    drwx------ 3 tungxen tungxen 34 Apr 22 09:04 bootstrap
    -rw------- 1 tungxen tungxen 1803 Apr 22 09:04 composer.json
    -rw------- 1 tungxen tungxen 218208 Apr 22 09:04 composer.lock
    drwx------ 3 tungxen tungxen 309 Apr 22 09:04 config
    drwx------ 8 tungxen tungxen 117 Apr 22 09:04 database
    -rw------- 1 tungxen tungxen 1256 Apr 22 09:04 package.json
    -rw------- 1 tungxen tungxen 430667 Apr 22 09:04 package-lock.json
    -rw------- 1 tungxen tungxen 1669 Apr 22 09:04 phpunit.xml
    drwx------ 7 tungxen tungxen 195 Apr 22 09:04 public
    -rw------- 1 tungxen tungxen 4198 Apr 22 09:04 readme.md
    drwx------ 6 tungxen tungxen 53 Apr 22 09:04 resources
    drwx------ 2 tungxen tungxen 75 Apr 22 09:04 routes
    -rw------- 1 tungxen tungxen 563 Apr 22 09:04 server.php
    drwx------ 5 tungxen tungxen 47 Apr 22 09:04 storage
    drwx------ 4 tungxen tungxen 104 Apr 22 09:04 tests
    -rw------- 1 tungxen tungxen 554 Apr 22 09:04 webpack.mix.js

0 Likes

#6

terminal: ps -aux | grep 'sublime_merge'

[tungxen@localhost public]$ ps -aux | grep ‘sublime_merge’
tungxen 18299 3.8 0.9 1242092 74140 tty2 Sl+ 11:29 0:00 /opt/sublime_merge/sublime_merge --multiinstance
tungxen 18334 0.0 0.0 12112 1080 pts/0 S+ 11:29 0:00 grep --color=auto sublime_merge

  1. if i click “Sublime Merge” on menu start
    rsz_1menu
    sublime merge > File > Clone Repository (input source Url github.com/…)

[tungxen@localhost tungxen.github.io]$ ls -l
total 100
drwx------ 2 tungxen tungxen 4096 Apr 22 08:35 amthanh
-rw------- 1 tungxen tungxen 509 Apr 22 08:35 css1.css
-rw------- 1 tungxen tungxen 376 Apr 22 08:35 css3.css
-rw------- 1 tungxen tungxen 433 Apr 22 08:35 css.css
…

  1. cd /opt/sublime_merge/ then click sublime_merge
    sublime merge > File > Clone Repository (input source Url github.com/…)

[tungxen@localhost tungxen.github.io.git1]$ ls -l
total 100
drwxr-xr-x 2 tungxen tungxen 4096 Apr 22 11:16 amthanh
-rw-r–r-- 1 tungxen tungxen 509 Apr 22 11:16 css1.css
-rw-r–r-- 1 tungxen tungxen 376 Apr 22 11:16 css3.css
-rw-r–r-- 1 tungxen tungxen 433 Apr 22 11:16 css.css
…

  1. run sublime_merge from terminal:

[tungxen@localhost public]$ /opt/sublime_merge/sublime_merge
[tungxen@localhost public]$

sublime merge > File > Clone Repository (input source Url github.com/…)

[tungxen@localhost tungxen.github.io.git5]$ ls -l
total 100
drwxrwxr-x 2 tungxen tungxen 4096 Apr 22 11:40 amthanh
-rw-rw-r-- 1 tungxen tungxen 509 Apr 22 11:40 css1.css
-rw-rw-r-- 1 tungxen tungxen 376 Apr 22 11:40 css3.css
-rw-rw-r-- 1 tungxen tungxen 433 Apr 22 11:40 css.css

why they are different?
-rw-------
-rw-r–r--
-rw-rw-r–

0 Likes

#7

Could you provide the debug info and console output of those differently behaving instances? The only difference between running Sublime Merge from the “start menu” and from the terminal is which environment variables are loaded, since depending on which login shell you’re using it may load different .profile/.bashrc like files when running the command line vs launching directly.

0 Likes

#8

where to find debug info?

0 Likes

#9

Under Help > Debug Information, the same place as in your first post.

0 Likes

#10
  1. if i click “Sublime Merge” on menu start

=== App Version Information ===
Build: 2009

=== Git Version Information ===
Using Git: git (system)
git version 2.18.2
PATH: /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin

=== Browse Page Information ===
HEAD: 86e06dd8b9e146ec0922ca6eabff44f64b332edf
Is in merge: 0
Is in cherry_pick: 0
Is in rebase: 0
Is in revert: 0

=== Git Status Information ===

=== Our Status Information ===

=== Git Config Information ===
branch.master.merge=refs/heads/master
branch.master.remote=origin
core.bare=false
core.filemode=true
core.logallrefupdates=true
core.repositoryformatversion=0
credential.helper=store
diff.guitool=kdiff3
diff.tool=kdiff3
difftool.kdiff3.path=/usr/bin/kdiff3
difftool.kdiff3.trustexitcode=false
difftool.prompt=false
filesystem.Oracle Corporation|14|/dev/mapper/cl-root.minracythreshold=1503 microseconds
filesystem.Oracle Corporation|14|/dev/mapper/cl-root.timestampresolution=8000 nanoseconds
merge.tool=kdiff3
mergetool.kdiff3.path=/usr/bin/kdiff3
mergetool.kdiff3.trusexitcode=false
mergetool.prompt=false
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
remote.origin.url=https://github.com/HoAnhTungPrimelabo/tungxen.github.io.git
user.email=anh.tung@primelabo.com.vn
user.name=Anh Tung

=== Our Config Information ===
Git Config Path Information
Using config path: /etc/gitconfig
Using config path: /home/tungxen/.config/git/config
Using config path: /home/tungxen/.gitconfig
Using config path: /home/tungxen/tungxen.github.io.git5/.git/config

Our config output is identical to the Git config output

=== Git Attributes Information ===
git check_attr --all output

=== Our Modified Files Newline Normalisation and EOL Information ===

  1. cd /opt/sublime_merge/ then click sublime_merge

=== App Version Information ===
Build: 2009

=== Git Version Information ===
Using Git: git (system)
git version 2.18.2
PATH: /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin

=== Browse Page Information ===
HEAD: 86e06dd8b9e146ec0922ca6eabff44f64b332edf
Is in merge: 0
Is in cherry_pick: 0
Is in rebase: 0
Is in revert: 0

=== Git Status Information ===

=== Our Status Information ===

=== Git Config Information ===
branch.master.merge=refs/heads/master
branch.master.remote=origin
core.bare=false
core.filemode=true
core.logallrefupdates=true
core.repositoryformatversion=0
credential.helper=store
diff.guitool=kdiff3
diff.tool=kdiff3
difftool.kdiff3.path=/usr/bin/kdiff3
difftool.kdiff3.trustexitcode=false
difftool.prompt=false
filesystem.Oracle Corporation|14|/dev/mapper/cl-root.minracythreshold=1503 microseconds
filesystem.Oracle Corporation|14|/dev/mapper/cl-root.timestampresolution=8000 nanoseconds
merge.tool=kdiff3
mergetool.kdiff3.path=/usr/bin/kdiff3
mergetool.kdiff3.trusexitcode=false
mergetool.prompt=false
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
remote.origin.url=https://github.com/HoAnhTungPrimelabo/tungxen.github.io.git
user.email=anh.tung@primelabo.com.vn
user.name=Anh Tung

=== Our Config Information ===
Git Config Path Information
Using config path: /etc/gitconfig
Using config path: /home/tungxen/.config/git/config
Using config path: /home/tungxen/.gitconfig
Using config path: /home/tungxen/tungxen.github.io.git5/.git/config

Our config output is identical to the Git config output

=== Git Attributes Information ===
git check_attr --all output

=== Our Modified Files Newline Normalisation and EOL Information ===

  1. run sublime_merge from terminal:

=== App Version Information ===
Build: 2009

=== Git Version Information ===
Using Git: git (system)
git version 2.18.2
PATH: /home/tungxen/.local/bin:/home/tungxen/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/tungxen/.composer/vendor/bin:/var/lib/snapd/snap/bin

=== Browse Page Information ===
HEAD: 86e06dd8b9e146ec0922ca6eabff44f64b332edf
Is in merge: 0
Is in cherry_pick: 0
Is in rebase: 0
Is in revert: 0

=== Git Status Information ===

=== Our Status Information ===

=== Git Config Information ===
branch.master.merge=refs/heads/master
branch.master.remote=origin
core.bare=false
core.filemode=true
core.logallrefupdates=true
core.repositoryformatversion=0
credential.helper=store
diff.guitool=kdiff3
diff.tool=kdiff3
difftool.kdiff3.path=/usr/bin/kdiff3
difftool.kdiff3.trustexitcode=false
difftool.prompt=false
filesystem.Oracle Corporation|14|/dev/mapper/cl-root.minracythreshold=1503 microseconds
filesystem.Oracle Corporation|14|/dev/mapper/cl-root.timestampresolution=8000 nanoseconds
merge.tool=kdiff3
mergetool.kdiff3.path=/usr/bin/kdiff3
mergetool.kdiff3.trusexitcode=false
mergetool.prompt=false
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
remote.origin.url=https://github.com/HoAnhTungPrimelabo/tungxen.github.io.git
user.email=anh.tung@primelabo.com.vn
user.name=Anh Tung

=== Our Config Information ===
Git Config Path Information
Using config path: /etc/gitconfig
Using config path: /home/tungxen/.config/git/config
Using config path: /home/tungxen/.gitconfig
Using config path: /home/tungxen/tungxen.github.io.git5/.git/config

Our config output is identical to the Git config output

=== Git Attributes Information ===
git check_attr --all output

=== Our Modified Files Newline Normalisation and EOL Information ===

0 Likes

#11

Given the terminal executed Sublime Merge has extra entries in the PATH, my best guess is that your login shell isn’t loading your environment variables and one of those is screwing up the permissions. Which login shell are you using? And for that matter, which distribution? It might also be good to check if there’s another install of git somewhere in those paths (which git).

1 Like

#12

Given the terminal executed Sublime Merge has extra entries in the PATH:

[tungxen@localhost public]$ /opt/sublime_merge/sublime_merge
[tungxen@localhost public]$

Which login shell are you using?

[tungxen@localhost public]$ echo “$SHELL”
/bin/bash
[tungxen@localhost public]$ ps -p $$
PID TTY TIME CMD
5922 pts/0 00:00:00 bash
[tungxen@localhost public]$ cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash

which distribution?

[tungxen@localhost public]$ cat /proc/version
Linux version 4.18.0-147.5.1.el8_1.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Wed Feb 5 02:00:39 UTC 2020

[tungxen@localhost public]$ cat /etc/os-release
NAME=“CentOS Linux”
VERSION=“8 (Core)”
ID=“centos”
ID_LIKE=“rhel fedora”
VERSION_ID=“8”
PLATFORM_ID=“platform:el8”
PRETTY_NAME=“CentOS Linux 8 (Core)”
ANSI_COLOR=“0;31”
CPE_NAME=“cpe:/o:centos:centos:8”
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT=“CentOS-8”
CENTOS_MANTISBT_PROJECT_VERSION=“8”
REDHAT_SUPPORT_PRODUCT=“centos”
REDHAT_SUPPORT_PRODUCT_VERSION=“8”

It might also be good to check if there’s another install of git somewhere in those paths:

[tungxen@localhost public]$ which git
/usr/bin/git

0 Likes

#13

If you have Sublime Text installed you could try running the following in the console to find out the environment variables in each situation:

import os
print(os.environ)
0 Likes

#15

how can i fix it?

my Sublime text 3 [portable version] in directory: /home/tungxen/programs/sublime_text_3
Sublime text > show console

  1. cd /home/tungxen/programs/sublime_text_3 then click sublime_text

import os
print(os.environ)
environ({‘USERNAME’: ‘tungxen’, ‘LC_NUMERIC’: ‘en_US.UTF-8’, ‘XDG_RUNTIME_DIR’: ‘/run/user/1000’, ‘XDG_SESSION_TYPE’: ‘x11’, ‘DBUS_STARTER_ADDRESS’: ‘unix:path=/run/user/1000/bus,guid=be7825e7c21c6896fe1421e35e9f861e’, ‘GNOME_DESKTOP_SESSION_ID’: ‘this-is-deprecated’, ‘SSH_AUTH_SOCK’: ‘/run/user/1000/keyring/ssh’, ‘MANAGERPID’: ‘3287’, ‘XDG_CURRENT_DESKTOP’: ‘GNOME’, ‘GDMSESSION’: ‘gnome’, ‘LC_PAPER’: ‘en_US.UTF-8’, ‘XDG_SESSION_DESKTOP’: ‘gnome’, ‘QT_IM_MODULE’: ‘ibus’, ‘LOGNAME’: ‘tungxen’, ‘XDG_SEAT’: ‘seat0’, ‘DBUS_STARTER_BUS_TYPE’: ‘session’, ‘XDG_VTNR’: ‘2’, ‘PATH’: ‘/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin’, ‘XDG_SESSION_ID’: ‘3’, ‘DISPLAY’: ‘:1’, ‘GDK_BACKEND’: ‘x11’, ‘LANG’: ‘en_GB.UTF-8’, ‘XDG_DATA_DIRS’: ‘/home/tungxen/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/’, ‘DESKTOP_SESSION’: ‘gnome’, ‘SHELL’: ‘/bin/bash’, ‘XAUTHORITY’: ‘/run/user/1000/gdm/Xauthority’, ‘JOURNAL_STREAM’: ‘9:58235’, ‘SESSION_MANAGER’: ‘local/unix:@/tmp/.ICE-unix/3376,unix/unix:/tmp/.ICE-unix/3376’, ‘LC_MEASUREMENT’: ‘en_US.UTF-8’, ‘PWD’: ‘/home/tungxen’, ‘GDM_LANG’: ‘en_GB.UTF-8’, ‘DBUS_SESSION_BUS_ADDRESS’: ‘unix:path=/run/user/1000/bus,guid=be7825e7c21c6896fe1421e35e9f861e’, ‘LC_MONETARY’: ‘en_US.UTF-8’, ‘USER’: ‘tungxen’, ‘WINDOWPATH’: ‘2’, ‘XMODIFIERS’: ‘@im=ibus’, ‘XDG_MENU_PREFIX’: ‘gnome-’, ‘LC_TIME’: ‘en_US.UTF-8’, ‘SHLVL’: ‘0’, ‘HOME’: ‘/home/tungxen’, ‘INVOCATION_ID’: ‘652bfede78924dd5a9b295c63ec45d73’})

  1. from terminal
    environ({‘MODULES_RUN_QUARANTINE’: ‘LD_LIBRARY_PATH’, ‘XMODIFIERS’: ‘@im=ibus’, ‘VTE_VERSION’: ‘5202’, ‘XDG_SESSION_ID’: ‘3’, ‘SSH_AUTH_SOCK’: ‘/run/user/1000/keyring/ssh’, ‘LC_PAPER’: ‘en_US.UTF-8’, ‘LANG’: ‘en_GB.UTF-8’, ‘BASH_FUNC_module%%’: ‘() { _moduleraw “$@” 2>&1\n}’, ‘USERNAME’: ‘tungxen’, ‘SESSION_MANAGER’: ‘local/unix:@/tmp/.ICE-unix/3376,unix/unix:/tmp/.ICE-unix/3376’, ‘ENV’: ‘/usr/share/Modules/init/profile.sh’, ‘BASH_FUNC_scl%%’: ‘() { if [ “$1” = “load” -o “$1” = “unload” ]; then\n eval “module $@”;\n else\n /usr/bin/scl “$@”;\n fi\n}’, ‘LOGNAME’: ‘tungxen’, ‘LESSOPEN’: ‘||/usr/bin/lesspipe.sh %s’, ‘DBUS_STARTER_BUS_TYPE’: ‘session’, ‘DBUS_STARTER_ADDRESS’: ‘unix:path=/run/user/1000/bus,guid=be7825e7c21c6896fe1421e35e9f861e’, ‘BASH_FUNC__moduleraw%%’: ‘() { unset _mlre _mlIFS _mlshdbg;\n if [ “${MODULES_SILENT_SHELL_DEBUG:-0}” = ‘1’ ]; then\n case “$-” in \n vx*)\n set +vx;\n _mlshdbg=‘vx’\n ;;\n v)\n set +v;\n _mlshdbg=‘v’\n ;;\n x)\n set +x;\n mlshdbg=‘x’\n ;;\n )\n _mlshdbg=’’\n ;;\n esac;\n fi;\n if [ -n “${IFS+x}” ]; then\n _mlIFS=$IFS;\n fi;\n IFS=’ ';\n for _mlv in ${MODULES_RUN_QUARANTINE:-};\n do\n if [ “${_mlv}” = "${_mlv##[!A-Za-z0-9]}" -a “${_mlv}” = “${_mlv#[0-9]}” ]; then\n if [ -n “eval \'echo ${\'$_mlv\'+x}\'” ]; then\n _mlre="${_mlre:-}${_mlv}_modquar=’eval \'echo ${\'$_mlv\'}\'’ “;\n fi;\n mlrv="MODULES_RUNENV${_mlv}”;\n _mlre="${_mlre:-}${_mlv}=’eval \'echo ${\'$_mlrv\':-}\'’ ";\n fi;\n done;\n if [ -n “${_mlre:-}” ]; then\n eval eval ${_mlre}/usr/bin/tclsh /usr/share/Modules/libexec/modulecmd.tcl bash \'"$@"\';\n else\n eval /usr/bin/tclsh /usr/share/Modules/libexec/modulecmd.tcl bash "$@";\n fi;\n _mlstatus=$?;\n if [ -n “${_mlIFS+x}” ]; then\n IFS=$_mlIFS;\n else\n unset IFS;\n fi;\n if [ -n “${_mlshdbg:-}” ]; then\n set -$_mlshdbg;\n fi;\n unset _mlre _mlv _mlrv _mlIFS _mlshdbg;\n return $mlstatus\n}’, ‘PWD’: ‘/home/tungxen/programs/sublime_text_3’, ‘XDG_SESSION_TYPE’: ‘x11’, ‘XDG_SESSION_DESKTOP’: ‘gnome’, ‘XDG_RUNTIME_DIR’: ‘/run/user/1000’, ‘OLDPWD’: ‘/home/tungxen/programs’, ‘TERM’: ‘xterm-256color’, ‘LC_NUMERIC’: ‘en_US.UTF-8’, ‘SSH_ASKPASS’: ‘/usr/libexec/openssh/gnome-ssh-askpass’, ‘INVOCATION_ID’: ‘652bfede78924dd5a9b295c63ec45d73’, ‘JOURNAL_STREAM’: ‘9:58235’, ‘LOADEDMODULES’: ‘’, ‘XDG_VTNR’: ‘2’, ‘MODULEPATH’: ‘/etc/scl/modulefiles:/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles’, ‘GDM_LANG’: ‘en_GB.UTF-8’, ‘XDG_DATA_DIRS’: ‘/home/tungxen/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop’, ‘USER’: ‘tungxen’, ‘GDK_BACKEND’: ‘x11’, ‘QT_IM_MODULE’: ‘ibus’, ‘XDG_MENU_PREFIX’: ‘gnome-’, ‘GNOME_DESKTOP_SESSION_ID’: ‘this-is-deprecated’, ‘GNOME_TERMINAL_SCREEN’: ‘/org/gnome/Terminal/screen/157b9200_0f44_4e6c_b7f8_1c5a240fcdad’, ‘PATH’: ‘/home/tungxen/.local/bin:/home/tungxen/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/tungxen/.composer/vendor/bin:/var/lib/snapd/snap/bin’, ‘SHELL’: ‘/bin/bash’, ‘MANAGERPID’: ‘3287’, ‘XAUTHORITY’: ‘/run/user/1000/gdm/Xauthority’, ‘WINDOWPATH’: ‘2’, ‘DESKTOP_SESSION’: ‘gnome’, ‘LC_MEASUREMENT’: ‘en_US.UTF-8’, ‘COLORTERM’: ‘truecolor’, ‘DBUS_SESSION_BUS_ADDRESS’: ‘unix:path=/run/user/1000/bus,guid=be7825e7c21c6896fe1421e35e9f861e’, ‘MODULESHOME’: ‘/usr/share/Modules’, ‘LS_COLORS’: ‘rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=01;05;37;41:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;40:.tar=38;5;9:.tgz=38;5;9:.arc=38;5;9:.arj=38;5;9:.taz=38;5;9:.lha=38;5;9:.lz4=38;5;9:.lzh=38;5;9:.lzma=38;5;9:.tlz=38;5;9:.txz=38;5;9:.tzo=38;5;9:.t7z=38;5;9:.zip=38;5;9:.z=38;5;9:.dz=38;5;9:.gz=38;5;9:.lrz=38;5;9:.lz=38;5;9:.lzo=38;5;9:.xz=38;5;9:.zst=38;5;9:.tzst=38;5;9:.bz2=38;5;9:.bz=38;5;9:.tbz=38;5;9:.tbz2=38;5;9:.tz=38;5;9:.deb=38;5;9:.rpm=38;5;9:.jar=38;5;9:.war=38;5;9:.ear=38;5;9:.sar=38;5;9:.rar=38;5;9:.alz=38;5;9:.ace=38;5;9:.zoo=38;5;9:.cpio=38;5;9:.7z=38;5;9:.rz=38;5;9:.cab=38;5;9:.wim=38;5;9:.swm=38;5;9:.dwm=38;5;9:.esd=38;5;9:.jpg=38;5;13:.jpeg=38;5;13:.mjpg=38;5;13:.mjpeg=38;5;13:.gif=38;5;13:.bmp=38;5;13:.pbm=38;5;13:.pgm=38;5;13:.ppm=38;5;13:.tga=38;5;13:.xbm=38;5;13:.xpm=38;5;13:.tif=38;5;13:.tiff=38;5;13:.png=38;5;13:.svg=38;5;13:.svgz=38;5;13:.mng=38;5;13:.pcx=38;5;13:.mov=38;5;13:.mpg=38;5;13:.mpeg=38;5;13:.m2v=38;5;13:.mkv=38;5;13:.webm=38;5;13:.ogm=38;5;13:.mp4=38;5;13:.m4v=38;5;13:.mp4v=38;5;13:.vob=38;5;13:.qt=38;5;13:.nuv=38;5;13:.wmv=38;5;13:.asf=38;5;13:.rm=38;5;13:.rmvb=38;5;13:.flc=38;5;13:.avi=38;5;13:.fli=38;5;13:.flv=38;5;13:.gl=38;5;13:.dl=38;5;13:.xcf=38;5;13:.xwd=38;5;13:.yuv=38;5;13:.cgm=38;5;13:.emf=38;5;13:.ogv=38;5;13:.ogx=38;5;13:.aac=38;5;45:.au=38;5;45:.flac=38;5;45:.m4a=38;5;45:.mid=38;5;45:.midi=38;5;45:.mka=38;5;45:.mp3=38;5;45:.mpc=38;5;45:.ogg=38;5;45:.ra=38;5;45:.wav=38;5;45:.oga=38;5;45:.opus=38;5;45:.spx=38;5;45:*.xspf=38;5;45:’, ‘SHLVL’: ‘1’, ‘HOME’: ‘/home/tungxen’, ‘XDG_CURRENT_DESKTOP’: ‘GNOME’, ‘BASH_ENV’: ‘/usr/share/Modules/init/bash’, ‘MODULEPATH_modshare’: ‘/usr/share/modulefiles:1:/etc/modulefiles:1:/usr/share/Modules/modulefiles:1’, ‘DISPLAY’: ‘:1’, '’: ‘./sublime_text’, ‘BASH_FUNC_switchml%%’: ‘() { typeset swfound=1;\n if [ “${MODULES_USE_COMPAT_VERSION:-0}” = ‘1’ ]; then\n typeset swname=‘main’;\n if [ -e /usr/share/Modules/libexec/modulecmd.tcl ]; then\n typeset swfound=0;\n unset MODULES_USE_COMPAT_VERSION;\n fi;\n else\n typeset swname=‘compatibility’;\n if [ -e /usr/share/Modules/libexec/modulecmd-compat ]; then\n typeset swfound=0;\n MODULES_USE_COMPAT_VERSION=1;\n export MODULES_USE_COMPAT_VERSION;\n fi;\n fi;\n if [ $swfound -eq 0 ]; then\n echo “Switching to Modules $swname version”;\n source /usr/share/Modules/init/bash;\n else\n echo “Cannot switch to Modules $swname version, command not found”;\n return 1;\n fi\n}’, ‘KDEDIRS’: ‘/usr’, ‘LC_MONETARY’: ‘en_US.UTF-8’, ‘XDG_SEAT’: ‘seat0’, ‘GNOME_TERMINAL_SERVICE’: ‘:1.129’, ‘LC_TIME’: ‘en_US.UTF-8’, ‘GDMSESSION’: ‘gnome’, ‘MODULES_CMD’: ‘/usr/share/Modules/libexec/modulecmd.tcl’})
0 Likes

#16

I found the fix https://askubuntu.com/questions/542152/desktop-file-with-bashrc-environment/906983

[tungxen@localhost applications]$ pwd
/usr/share/applications
[tungxen@localhost applications]$ vim sublime_merge.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Merge
GenericName=Git Client
Comment=Sublime Merge is a Git client, from the makers of Sublime Text
Exec=/opt/sublime_merge/sublime_merge %F
Terminal=false
MimeType=text/plain;
Icon=sublime-merge
Categories=Development;
StartupNotify=true
Actions=Window;Document;

change
Exec=/opt/sublime_merge/sublime_merge %F
=>
Exec=bash -c "source ~/.bashrc && /opt/sublime_merge/sublime_merge %F"

So the question is - Is there another solution? proper way

[tungxen@localhost ~]$ pwd
/home/tungxen
[tungxen@localhost ~]$ ls -a
.              .bash_profile  .dbus      Downloads          .fonts            .gnome         .java              .mozc     .mysql_history  .phpls           programs  .swt          .vim        .wget-hsts
..             .bashrc        Desktop    .eclipse           .gitconfig        .gnupg         .local             .mozilla  .nbi            .PhpStorm2019.3  Public    Templates     .viminfo    workspace
.bash_history  .cache         .docker    eclipse-workspace  .git-credentials  .ICEauthority  marcari-platform   Music     .netbeans       Pictures         snap      .thunderbird  .vscode
.bash_logout   .config        Documents  .esd_auth          .gitkraken        index.html     marcari-platform2  .mysql    .npm            .pki             .ssh      Videos        .webclipse
[tungxen@localhost ~]$
0 Likes

#17

I’d follow the recommendations here: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html, put environment variables in bashrc and then load them from bash_profile.

1 Like