UndeadKernel / pacfiles-mode

Emacs major mode to manage pacnew and pacsave files left by the pacman Arch tool
MIT License
42 stars 2 forks source link

pacfiles--insert-pending-files: Getting attributes: File name too long #8

Closed podiki closed 2 years ago

podiki commented 3 years ago

Hitting an error when running pacfiles, see below. Not sure what the gibberish is about, but it starts with /etc/ which is the directory of the open file when I start pacfiles (would be my home directory if I was in there instead). It ends with the actual pacfile.

pacfiles--insert-pending-files: Getting attributes: File name too long, /etc/]4;0;#271f1b\]4;1;#b86b78\]4;2;#c0a3b8\]4;3;#c69c8c\]4;4;#6250aa\]4;5;#a07ba8\]4;6;#7e68aa\]4;7;#c9c7c6\]4;8;#44362f\]4;9;#ff788f\]4;10;#ffbcf9\]4;11;#ffc0a0\]4;12;#7557ed\]4;13;#dc8ded\]4;14;#9d75ee\]4;15;#fffefd\]10;#fffefd\]11;[50]#271f1b\]12;#fffefd\]13;#fffefd\]17;#fffefd\]19;#271f1b\]4;232;#271f1b\]4;256;#fffefd\]708;[50]#271f1b\/etc/systemd/timesyncd.conf

Interface will display many of the pacfiles, but then end with a similar output, below. I can Look at diffs or try a merge, but when exiting from ediff the interface is gone (something has gone wrong).

[merge] [diff] [delete] /etc/systemd/homed.conf.pacnew (239.6 day[s] ahead)
[merge]        [delete] ]4;0;#271f1b\]4;1;#b86b78\]4;2;#c0a3b8\]4;3;#c69c8c\]4;4;#6250aa\]4;5;#a07ba8\]4;6;#7e68aa\]4;7;#c9c7c6\]4;8;#44362f\]4;9;#ff788f\]4;10;#ffbcf9\]4;11;#ffc0a0\]4;12;#7557ed\]4;13;#dc8ded\]4;14;#9d75ee\]4;15;#fffefd\]10;#fffefd\]11;[50]#271f1b\]12;#fffefd\]13;#fffefd\]17;#fffefd\]19;#271f1b\]4;232;#271f1b\]4;256;#fffefd\]708;[50]#271f1b\/etc/systemd/timesyncd.conf.pacnew 

Any idea what is happening here? I don't have any strange files in /etc/ or /home/ or wherever the current working directory is. Not sure where the file is that is causing it to trip up. The find command used to find the pacfiles works fine in a terminal.

UndeadKernel commented 3 years ago

Thanks for the bug report @podiki. I'll take a look at this issue tomorrow.

podiki commented 3 years ago

Let me know if there is anything else you need. This just happens on one computer, not the other (and should be nearly identical set up). And pretty sure pacfiles worked fine on this computer, not sure what changed or when.

UndeadKernel commented 3 years ago

@podiki, could you please call toggle-debug-on-error and share with me any backtrace that you may be getting? It's not obvious to me yet why you are getting that garbled text. Could you also share with me what is the output of find /etc -name '*.pacnew' -o -name '*.pacsave' 2>/dev/null?

podiki commented 3 years ago

Now something similar is happening on my other computer as well, which has no pacnew files (no output for the command you gave). Even though I enabled debug on error, doesn't seem to be tripping it for some reason. Here is the output in *Messages*:

pacfiles-revert-buffer: Cannot process file ]4;0;#252525\]4;1;#fd971f\]4;2;#5e7175\]4;3;#a6e22e\]4;4;#435e87\]4;5;#ff9f95\]4;6;#789ec6\]4;7;#dbdcdc\]4;8;#3e3e3e\]4;9;#ffc515\]4;10;#6c9ba5\]4;11;#ddff2a\]4;12;#4977bc\]4;13;#ffb4a2\]4;14;#87ccff\]4;15;#feffff\]10;#feffff\]11;#252525\]12;#feffff\]13;#feffff\]17;#feffff\]19;#252525\]4;232;#252525\]4;256;#feffff\]708;#252525\

The entire buffer for pacfiles mode is just:

* PACFILES MODE

I'll try on the original computer I saw the error on later and add that here too.

UndeadKernel commented 3 years ago

@podiki, have you tried to see if the problem persist in your first computer? I'm still trying to figure out what the problem could be. Which locales are you using? What is the output of the command locale?

podiki commented 3 years ago

Thanks for reminding me. I did get a more useful debug from the original computer I was seeing the problem. Here it is:

Debugger entered--Lisp error: (file-error "Getting attributes" "File name too long" "/home/john/Dropbox/org/\33]4;0;#271f1b\33\\\33]4;1;#b86b7...")
  pacfiles--insert-days-old("\33]4;0;#271f1b\33\\\33]4;1;#b86b78\33\\\33]4;2;#c0a3b8\33\\\33]4;3...")
  pacfiles--insert-pending-files((("/etc/pam.d/i3lock.pacnew" . "/tmp/d3d549f86f.pacmerge") ("/etc/makepkg.conf.pacnew" . "/tmp/457416bf02.pacmerge") ("/etc/pacman.conf.pacnew" . "/tmp/79ec9a33e4.pacmerge") ("/etc/locale.gen.pacnew" . "/tmp/0d463376ca.pacmerge") ("/etc/mkinitcpio.conf.pacnew" . "/tmp/0f3c8d7eba.pacmerge") ("/etc/default/grub.pacnew" . "/tmp/6d14f782b1.pacmerge") ("/etc/systemd/homed.conf.pacnew" . "/tmp/ddeb0e55c7.pacmerge") ("\33]4;0;#271f1b\33\\\33]4;1;#b86b78\33\\\33]4;2;#c0a3b8\33\\\33]4;3..." . "/tmp/3af28bbd49.pacmerge")) ("\33]4;0;#271f1b\33\\\33]4;1;#b86b78\33\\\33]4;2;#c0a3b8\33\\\33]4;3..."))
  pacfiles-revert-buffer(t t)
  pacfiles()
  funcall-interactively(pacfiles)
  command-execute(pacfiles record)
  counsel-M-x-action("pacfiles")
  ivy-call()
  #f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially.  An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero.  Otherwise, use the first occurrence of\nPRESELECT in the collection.  Comparison is first done with\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input.  It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x1f387732f5ad9e24>)("M-x " ("pacfiles" "toggle-debug-on-error" "emacs-init-time" "toggle-day-night-theme" "paradox-list-packages" "xwidget-webkit-browse-url" "pdf-tools-install" "slime" "mu4e" "highlight-sexp-mode" "calc" "org-msg-mode" "revert-buffer" "load-theme" "org-gcal-fetch" "count-words" "comment-region" "olivetti-mode" "org2blog-user-interface" "insert-char" "linum-mode" "slime-connect" "ivy-switch-view" "org-gcal-sync" "org-table-move-row-up" "org-variable-pitch-minor-mode" "visual-line-mode" "make-frame" "recover-session" "org-ref-bibtex-assoc-pdf-with-entry" "flyspell-mode" "eshell" "ivy-push-view" "ivy-rich-mode" "counsel-recentf" "visual-fill-column-mode" "org-noter" "comment-line" "recover-this-file" "mc/mark-all-in-region" "vterm" "set-fill-column" "org-mode" "uncomment-region" "ein:jupyter-server-start" "eww" "recentf-cleanup" "ein:jupyter-server-stop" "ansi-term" "load-file" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  ivy-posframe--read(#f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially.  An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero.  Otherwise, use the first occurrence of\nPRESELECT in the collection.  Comparison is first done with\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input.  It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x1f387732f5ad9e24>) "M-x " ("pacfiles" "toggle-debug-on-error" "emacs-init-time" "toggle-day-night-theme" "paradox-list-packages" "xwidget-webkit-browse-url" "pdf-tools-install" "slime" "mu4e" "highlight-sexp-mode" "calc" "org-msg-mode" "revert-buffer" "load-theme" "org-gcal-fetch" "count-words" "comment-region" "olivetti-mode" "org2blog-user-interface" "insert-char" "linum-mode" "slime-connect" "ivy-switch-view" "org-gcal-sync" "org-table-move-row-up" "org-variable-pitch-minor-mode" "visual-line-mode" "make-frame" "recover-session" "org-ref-bibtex-assoc-pdf-with-entry" "flyspell-mode" "eshell" "ivy-push-view" "ivy-rich-mode" "counsel-recentf" "visual-fill-column-mode" "org-noter" "comment-line" "recover-this-file" "mc/mark-all-in-region" "vterm" "set-fill-column" "org-mode" "uncomment-region" "ein:jupyter-server-start" "eww" "recentf-cleanup" "ein:jupyter-server-stop" "ansi-term" "load-file" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  apply(ivy-posframe--read #f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially.  An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero.  Otherwise, use the first occurrence of\nPRESELECT in the collection.  Comparison is first done with\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input.  It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x1f387732f5ad9e24>) ("M-x " ("pacfiles" "toggle-debug-on-error" "emacs-init-time" "toggle-day-night-theme" "paradox-list-packages" "xwidget-webkit-browse-url" "pdf-tools-install" "slime" "mu4e" "highlight-sexp-mode" "calc" "org-msg-mode" "revert-buffer" "load-theme" "org-gcal-fetch" "count-words" "comment-region" "olivetti-mode" "org2blog-user-interface" "insert-char" "linum-mode" "slime-connect" "ivy-switch-view" "org-gcal-sync" "org-table-move-row-up" "org-variable-pitch-minor-mode" "visual-line-mode" "make-frame" "recover-session" "org-ref-bibtex-assoc-pdf-with-entry" "flyspell-mode" "eshell" "ivy-push-view" "ivy-rich-mode" "counsel-recentf" "visual-fill-column-mode" "org-noter" "comment-line" "recover-this-file" "mc/mark-all-in-region" "vterm" "set-fill-column" "org-mode" "uncomment-region" "ein:jupyter-server-start" "eww" "recentf-cleanup" "ein:jupyter-server-stop" "ansi-term" "load-file" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x))
  ivy-read("M-x " ("pacfiles" "toggle-debug-on-error" "emacs-init-time" "toggle-day-night-theme" "paradox-list-packages" "xwidget-webkit-browse-url" "pdf-tools-install" "slime" "mu4e" "highlight-sexp-mode" "calc" "org-msg-mode" "revert-buffer" "load-theme" "org-gcal-fetch" "count-words" "comment-region" "olivetti-mode" "org2blog-user-interface" "insert-char" "linum-mode" "slime-connect" "ivy-switch-view" "org-gcal-sync" "org-table-move-row-up" "org-variable-pitch-minor-mode" "visual-line-mode" "make-frame" "recover-session" "org-ref-bibtex-assoc-pdf-with-entry" "flyspell-mode" "eshell" "ivy-push-view" "ivy-rich-mode" "counsel-recentf" "visual-fill-column-mode" "org-noter" "comment-line" "recover-this-file" "mc/mark-all-in-region" "vterm" "set-fill-column" "org-mode" "uncomment-region" "ein:jupyter-server-start" "eww" "recentf-cleanup" "ein:jupyter-server-stop" "ansi-term" "load-file" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  command-execute(counsel-M-x)

Where the last line of the pacfiles buffer is

[merge]        [delete] ]4;0;#271f1b\]4;1;#b86b78\]4;2;#c0a3b8\]4;3;#c69c8c\]4;4;#6250aa\]4;5;#a07ba8\]4;6;#7e68aa\]4;7;#c9c7c6\]4;8;#44362f\]4;9;#ff788f\]4;10;#ffbcf9\]4;11;#ffc0a0\]4;12;#7557ed\]4;13;#dc8ded\]4;14;#9d75ee\]4;15;#fffefd\]10;#fffefd\]11;[50]#271f1b\]12;#fffefd\]13;#fffefd\]17;#fffefd\]19;#271f1b\]4;232;#271f1b\]4;256;#fffefd\]708;[50]#271f1b\/etc/systemd/timesyncd.conf.pacnew 

And this is locale:

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

EDIT: the folder it is complaining about a file has no long file names and should be all plain text (org) files. I removed one long file (still nothing strange) but nothing changed.

UndeadKernel commented 3 years ago

Cold you now show me the contents of the file /tmp/3af28bbd49.pacmerge? What happens if you add to the beginning of your configuration this:

(setq-default shell-file-name "/bin/bash")
podiki commented 3 years ago

I don't see any .pacmerge files in /tmp (not sure when/if they are created, but I looked while still debugging and after and didn't see any).

But changing shell-file-name seems to do the trick! No errors after setting that. From the help on this variable, this is what mine was set to (I do indeed use zsh and that is from SHELL):

Its value is "/bin/zsh"
Original value was "/bin/sh"
UndeadKernel commented 3 years ago

For whatever reason, zsh is adding a bunch of ASCII codes to the output of the search command. I have the feeling that there is a plugin in your zsh configuration causing problems. I for example use /usr/bin/fish as the value of shell-file-name and don't have any problems with it.

podiki commented 3 years ago

I'm guessing it is from wpgtk: https://github.com/deviantfero/wpgtk/wiki/Colorschemes#restore-on-terminals (terminal color sequences loaded). I actually have that in .zshenv instead of .zshrc so that some autorun terminal programs (not via interactive) pick up the colors. Don't think I've run into any other problems with that, but that could be it here.

UndeadKernel commented 3 years ago

I'm not entirely sure what I could change in pacfiles to make sure that this is not an issue. I'll keep doing some research and see what could be done. If I cannot reproduce it, or find a proper way to fix it, I might have to close this issue without a "proper" solution.

podiki commented 3 years ago

No worries. Also not clear to me why it works some times but not others. Perhaps if other commands have been run? I'm fine with the workaround of changing shell-file-name on my end, but if you find a fix in pacfiles I can definitely test it.