From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Benedikt Tissot Newsgroups: gmane.emacs.devel Subject: shell-command-to-string uses local shell for remote Date: Sun, 31 Mar 2019 21:28:10 +0200 Message-ID: <1554060490.28676.0@googlemail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-6a9TJsmF08mMS3Bwfi7E" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="127504"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 31 22:19:06 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAgv2-000WtI-3x for ged-emacs-devel@m.gmane.org; Sun, 31 Mar 2019 22:19:04 +0200 Original-Received: from localhost ([127.0.0.1]:50214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAguv-0000AH-MW for ged-emacs-devel@m.gmane.org; Sun, 31 Mar 2019 16:18:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAg9r-0005iI-Ju for emacs-devel@gnu.org; Sun, 31 Mar 2019 15:30:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAg9q-0008M0-Kw for emacs-devel@gnu.org; Sun, 31 Mar 2019 15:30:19 -0400 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:40504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAg9q-0008Kr-4s for emacs-devel@gnu.org; Sun, 31 Mar 2019 15:30:18 -0400 Original-Received: by mail-wm1-x331.google.com with SMTP id z24so8841599wmi.5 for ; Sun, 31 Mar 2019 12:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=date:from:subject:to:message-id:mime-version; bh=brpadzs4DcsHQmJxJmUJ9LRq94spHeSdB1SNYpJ0kYc=; b=lx/UMpaGTbuNHo5YhFCaSoI+qEJLka5aVksdYUBCVFIQMo9JiXwsPQjFQnB/j/i73S Su/04alhfe0ZErX/U1jhFw/UEOI624WzEVpcDCbyzAkGrVTr7GCSWRB4tZiks7Q1M2Ca rwcihKPqrMScPmMbOeCFFLEzAmYgbmPdRWKmxgfdOM9KEGjnj94CwNL9TIwAWrTJznPQ +iUNIWrmDN1x5R9lpw5gWER0bMy3m4TR6IqqA5wugzUkUMoUafG6xKntH8V7XpYcJAus 1GR4M+VYJninMz43HVQpUED6b6NCIzzNlOVow7OUY4NXxXAqMLM9YD+DTeXhyh/vAchT eNbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:message-id:mime-version; bh=brpadzs4DcsHQmJxJmUJ9LRq94spHeSdB1SNYpJ0kYc=; b=r/yro6MC9VUAzR9xbXT0R9LGK5plhqbq9Q1ev7gN+L47/waRQ8bnPRXFrQdQnrBkyS QLVA7bHGxUfhfg0zeYZVqO/L3iwKpCv5H6U13l9FB4ePA40wdB5/W4enAqH8IR7g5KdW sDdP4tUMTELqEYo+qKLBTG9dmofBISuY2at+bobVIowSIuSnyyRext9COgFNzo7gTcdB i6TJnZSsECnx7OWtL+GnLeAGeriZ4MxNMKQ+o8eCXgvnuwqtUV4sfE2kRrJ1JzRfyuEB AVfd1yRFj6RbWswCG26hIeYdx5UvF/r4ifNpJX9nU6pOga7++lnN6GOb9FDRmsvp1AVv O+LA== X-Gm-Message-State: APjAAAVCYM01eykNTtIHBksD3a2f1B5mWAjdo4r/n/1YZV2bgh5ce3CI 3DlmtC4LRyD5NLcjEEBCo1aIirxo X-Google-Smtp-Source: APXvYqwJvLJjzCw6WwbesKQgv9DCjZmWVmU1TtyJg+uVFJq+1THAhed9DHUmH56vbTcBIb0m8OASlw== X-Received: by 2002:a1c:c910:: with SMTP id f16mr9700432wmb.47.1554060615696; Sun, 31 Mar 2019 12:30:15 -0700 (PDT) Original-Received: from [192.168.2.130] (dslb-002-202-112-150.002.202.pools.vodafone-ip.de. [2.202.112.150]) by smtp.gmail.com with ESMTPSA id 132sm11357498wmd.30.2019.03.31.12.30.14 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 31 Mar 2019 12:30:14 -0700 (PDT) X-Mailer: geary/3.32.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 X-Mailman-Approved-At: Sun, 31 Mar 2019 16:18:48 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234843 Archived-At: --=-6a9TJsmF08mMS3Bwfi7E Content-Type: text/plain; charset=us-ascii; format=flowed Hello dear emacs maintainers, If the local used shell does not exist on the remote the shell-command-to-string function from simple.el does not work as expected. The reason for this is that the variable shell-file-name is wrong and therefore one only gets a string saying that the shell does not exist. Changing the function to (defun shell-command-to-string (command) "Execute shell command COMMAND and return its output as a string." (with-output-to-string (with-current-buffer standard-output (let ((shell-file-name (with-temp-buffer (apply #'process-file "printenv" nil t nil '("SHELL")) (string-trim-right (buffer-string))))) (process-file shell-file-name nil t nil shell-command-switch command))))) does work for remotes that do not have the local shell, too. I hope this is the right place for this and additionally wanted to thank you for maintaining emacs. Best regards, Benedikt Tissot --=-6a9TJsmF08mMS3Bwfi7E Content-Type: text/html; charset=us-ascii
Hello dear emacs maintainers,

If the local used shell does not exist on the remote the shell-command-to-string function from simple.el does not work as expected. The reason for this is that the variable shell-file-name is wrong and therefore one only gets a string saying that the shell does not exist.
Changing the function to 
(defun shell-command-to-string (command)
  "Execute shell command COMMAND and return its output as a string."
  (with-output-to-string
    (with-current-buffer
      standard-output
      (let ((shell-file-name
              (with-temp-buffer
               (apply #'process-file "printenv" nil t nil '("SHELL"))
               (string-trim-right (buffer-string)))))
        (process-file shell-file-name nil t nil shell-command-switch command)))))
does work for remotes that do not have the local shell, too.
I hope this is the right place for this and additionally wanted to thank you for maintaining emacs.

Best regards,
Benedikt Tissot
--=-6a9TJsmF08mMS3Bwfi7E--