From 556680cf5ef17b7dd394dcdbcf06b89781390d08 Mon Sep 17 00:00:00 2001
From: Kevin Stone
Date: Sat, 2 Aug 2014 00:04:26 -0700
Subject: [PATCH 1/9] Update grunt.fish
Fixed command error when no local Gruntfile results in a command error.
Fixes #1592.
---
share/completions/grunt.fish | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/share/completions/grunt.fish b/share/completions/grunt.fish
index 145801ff1..f02578ea1 100644
--- a/share/completions/grunt.fish
+++ b/share/completions/grunt.fish
@@ -8,8 +8,7 @@
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
function __grunt_print_tasks
- set -l info (grunt --version --verbose ^/dev/null)
- set -l tasks (echo $info[4] | sed -e 's/Available tasks: //' | tr ' ' '\n')
+ set -l tasks (grunt --version --verbose ^/dev/null | awk '/Available tasks: / {$1=$2=""; print $0}' | awk '{$1=$1}1' | tr ' ' '\n')
for t in $tasks
echo $t
end
From 87abcecca605397fb0e21567de40bc7592c374ac Mon Sep 17 00:00:00 2001
From: jianjun
Date: Mon, 14 Jul 2014 23:34:15 +0800
Subject: [PATCH 2/9] add command line string as $argv[1] for fish_title
---
builtin.cpp | 2 +-
reader.cpp | 13 +++++++++----
reader.h | 4 +++-
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/builtin.cpp b/builtin.cpp
index 5ab3ea430..7ffcb773b 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -3251,7 +3251,7 @@ static int builtin_fg(parser_t &parser, wchar_t **argv)
const wcstring ft = tok_first(j->command_wcstr());
if (! ft.empty())
env_set(L"_", ft.c_str(), ENV_EXPORT);
- reader_write_title();
+ reader_write_title(j->command_wcstr());
make_first(j);
job_set_flag(j, JOB_FOREGROUND, 1);
diff --git a/reader.cpp b/reader.cpp
index 44a219d5f..336513d80 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -902,7 +902,7 @@ bool reader_thread_job_is_stale()
return (void*)(uintptr_t) s_generation_count != pthread_getspecific(generation_count_key);
}
-void reader_write_title()
+void reader_write_title(const wchar_t *cmd)
{
const wchar_t *title;
const env_var_t term_str = env_get_string(L"TERM");
@@ -946,7 +946,12 @@ void reader_write_title()
}
- title = function_exists(L"fish_title")?L"fish_title":DEFAULT_TITLE;
+ wcstring fish_title = L"fish_title";
+ if (cmd) {
+ fish_title.append(L" ");
+ fish_title.append(parse_util_escape_string_with_quote(cmd, L'\0'));
+ }
+ title = function_exists(L"fish_title")?fish_title.c_str():DEFAULT_TITLE;
if (wcslen(title) ==0)
return;
@@ -1015,7 +1020,7 @@ static void exec_prompt()
}
/* Write the screen title */
- reader_write_title();
+ reader_write_title(0);
}
void reader_init()
@@ -2535,7 +2540,7 @@ void reader_run_command(parser_t &parser, const wcstring &cmd)
if (! ft.empty())
env_set(L"_", ft.c_str(), ENV_GLOBAL);
- reader_write_title();
+ reader_write_title(cmd.c_str());
term_donate();
diff --git a/reader.h b/reader.h
index 3375851a8..cd39915f5 100644
--- a/reader.h
+++ b/reader.h
@@ -116,8 +116,10 @@ void reader_pop_current_filename();
Write the title to the titlebar. This function is called just
before a new application starts executing and just after it
finishes.
+
+ \param cmd Command line string passed to \c fish_title if is defined.
*/
-void reader_write_title();
+void reader_write_title(const wchar_t *cmd);
/**
Call this function to tell the reader that a repaint is needed, and
From b97a94ccc80990dae4e7d0f2deb4fda7b11ccd75 Mon Sep 17 00:00:00 2001
From: ridiculousfish
Date: Sat, 2 Aug 2014 21:01:40 -0700
Subject: [PATCH 3/9] Clean up reader_write_title to work with wcstring
---
builtin.cpp | 2 +-
reader.cpp | 29 +++++++++++++----------------
reader.h | 2 +-
3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/builtin.cpp b/builtin.cpp
index 7ffcb773b..cb06481f0 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -3251,7 +3251,7 @@ static int builtin_fg(parser_t &parser, wchar_t **argv)
const wcstring ft = tok_first(j->command_wcstr());
if (! ft.empty())
env_set(L"_", ft.c_str(), ENV_EXPORT);
- reader_write_title(j->command_wcstr());
+ reader_write_title(j->command());
make_first(j);
job_set_flag(j, JOB_FOREGROUND, 1);
diff --git a/reader.cpp b/reader.cpp
index 336513d80..2f1e6c2dc 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -902,9 +902,8 @@ bool reader_thread_job_is_stale()
return (void*)(uintptr_t) s_generation_count != pthread_getspecific(generation_count_key);
}
-void reader_write_title(const wchar_t *cmd)
+void reader_write_title(const wcstring &cmd)
{
- const wchar_t *title;
const env_var_t term_str = env_get_string(L"TERM");
/*
@@ -934,7 +933,6 @@ void reader_write_title(const wchar_t *cmd)
{
char *n = ttyname(STDIN_FILENO);
-
if (contains(term, L"linux"))
{
return;
@@ -942,24 +940,23 @@ void reader_write_title(const wchar_t *cmd)
if (strstr(n, "tty") || strstr(n, "/vc/"))
return;
-
-
}
- wcstring fish_title = L"fish_title";
- if (cmd) {
- fish_title.append(L" ");
- fish_title.append(parse_util_escape_string_with_quote(cmd, L'\0'));
+ wcstring fish_title_command = DEFAULT_TITLE;
+ if (function_exists(L"fish_title"))
+ {
+ fish_title_command = L"fish_title";
+ if (! cmd.empty())
+ {
+ fish_title_command.append(L" ");
+ fish_title_command.append(parse_util_escape_string_with_quote(cmd, L'\0'));
+ }
}
- title = function_exists(L"fish_title")?fish_title.c_str():DEFAULT_TITLE;
-
- if (wcslen(title) ==0)
- return;
wcstring_list_t lst;
proc_push_interactive(0);
- if (exec_subshell(title, lst, false /* do not apply exit status */) != -1)
+ if (exec_subshell(fish_title_command, lst, false /* do not apply exit status */) != -1)
{
if (! lst.empty())
{
@@ -1020,7 +1017,7 @@ static void exec_prompt()
}
/* Write the screen title */
- reader_write_title(0);
+ reader_write_title(L"");
}
void reader_init()
@@ -2540,7 +2537,7 @@ void reader_run_command(parser_t &parser, const wcstring &cmd)
if (! ft.empty())
env_set(L"_", ft.c_str(), ENV_GLOBAL);
- reader_write_title(cmd.c_str());
+ reader_write_title(cmd);
term_donate();
diff --git a/reader.h b/reader.h
index cd39915f5..f89bd50e9 100644
--- a/reader.h
+++ b/reader.h
@@ -119,7 +119,7 @@ void reader_pop_current_filename();
\param cmd Command line string passed to \c fish_title if is defined.
*/
-void reader_write_title(const wchar_t *cmd);
+void reader_write_title(const wcstring &cmd);
/**
Call this function to tell the reader that a repaint is needed, and
From 0daee33ad6e581aa60f6ad6b78c5f69bdcaf45cb Mon Sep 17 00:00:00 2001
From: ridiculousfish
Date: Sun, 3 Aug 2014 00:00:26 -0700
Subject: [PATCH 4/9] Document new fish_title behavior per #334
---
doc_src/index.hdr.in | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index b33ec50f6..758a597b8 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -1326,16 +1326,29 @@ executed or put into the foreground and the output is used as a
titlebar message. The $_ environment variable will always contain the
name of the job to be put into the foreground (Or 'fish' if control is
returning to the shell) when the \c fish_prompt function is called.
+The first argument to fish_title will contain the most
+recently executed foreground command as a string, starting with fish 2.2.
-Example:
+Examples:
The default \c fish title is
function fish_title
- echo $_ ' '
- pwd
+ echo $_ ' '
+ pwd
+end
+
+
+
+
Date: Sun, 3 Aug 2014 15:40:44 +0800
Subject: [PATCH 5/9] Remove getpeerid/getpeerucred and fallbacks
---
configure.ac | 4 +--
doc_src/license.hdr | 29 -----------------
fallback.cpp | 79 ---------------------------------------------
fallback.h | 4 ---
osx/config.h | 6 ----
5 files changed, 2 insertions(+), 120 deletions(-)
diff --git a/configure.ac b/configure.ac
index b46accb7b..037ee8fad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -389,7 +389,7 @@ fi
# Check presense of various header files
#
-AC_CHECK_HEADERS([getopt.h termios.h sys/resource.h term.h ncurses/term.h ncurses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h execinfo.h spawn.h sys/sysctl.h sys/un.h sys/ucred.h ucred.h ])
+AC_CHECK_HEADERS([getopt.h termios.h sys/resource.h term.h ncurses/term.h ncurses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h execinfo.h spawn.h sys/sysctl.h])
if test x$local_gettext != xno; then
AC_CHECK_HEADERS([libintl.h])
@@ -535,7 +535,7 @@ fi
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf )
AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc )
AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg mkostemp )
-AC_CHECK_FUNCS( backtrace backtrace_symbols sysconf getifaddrs getpeerucred getpeereid )
+AC_CHECK_FUNCS( backtrace backtrace_symbols sysconf getifaddrs )
if test x$local_gettext != xno; then
AC_CHECK_FUNCS( gettext dcgettext )
diff --git a/doc_src/license.hdr b/doc_src/license.hdr
index 4403620d5..f431e07aa 100644
--- a/doc_src/license.hdr
+++ b/doc_src/license.hdr
@@ -1400,35 +1400,6 @@ POSSIBILITY OF SUCH DAMAGES.
-
-
-License for getpeereid
-
-\c fish contains code imported from the PostgreSQL project under
-license, namely the getpeereid fallback function. This code is copyrighted
-by:
-
-Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
-
-Portions Copyright (c) 1994, The Regents of the University of California
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose, without fee, and without a written agreement
-is hereby granted, provided that the above copyright notice and this
-paragraph and the following two paragraphs appear in all copies.
-
-IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
-LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
-PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
License for UTF8
Copyright (c) 2007 Alexey Vatchenko
diff --git a/fallback.cpp b/fallback.cpp
index 8abb8e48a..d69d76f4c 100644
--- a/fallback.cpp
+++ b/fallback.cpp
@@ -15,9 +15,7 @@
#include
#include
#include
-#include
#include
-#include
#include
#include
#include
@@ -1523,80 +1521,3 @@ static int mk_wcswidth(const wchar_t *pwcs, size_t n)
}
#endif // HAVE_BROKEN_WCWIDTH
-
-#ifndef HAVE_GETPEEREID
-
-/*-------------------------------------------------------------------------
- *
- * getpeereid.c
- * get peer userid for UNIX-domain socket connection
- *
- * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
- *
- *
- * IDENTIFICATION
- * src/port/getpeereid.c
- *
- *-------------------------------------------------------------------------
- */
-
-#ifdef HAVE_SYS_UN_H
-#include
-#endif
-#ifdef HAVE_UCRED_H
-#include
-#endif
-#ifdef HAVE_SYS_UCRED_H
-#include
-#endif
-
-/*
- * BSD-style getpeereid() for platforms that lack it.
- */
-int getpeereid(int sock, uid_t *uid, gid_t *gid)
-{
-#if defined(SO_PEERCRED)
- /* Linux: use getsockopt(SO_PEERCRED) */
- struct ucred peercred;
- socklen_t so_len = sizeof(peercred);
-
- if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 ||
- so_len != sizeof(peercred))
- return -1;
- *uid = peercred.uid;
- *gid = peercred.gid;
- return 0;
-#elif defined(LOCAL_PEERCRED)
- /* Debian with FreeBSD kernel: use getsockopt(LOCAL_PEERCRED) */
- struct xucred peercred;
- socklen_t * so_len = sizeof(peercred);
-
- if (getsockopt(sock, 0, LOCAL_PEERCRED, &peercred, &so_len) != 0 ||
- so_len != sizeof(peercred) ||
- peercred.cr_version != XUCRED_VERSION)
- return -1;
- *uid = peercred.cr_uid;
- *gid = peercred.cr_gid;
- return 0;
-#elif defined(HAVE_GETPEERUCRED)
- /* Solaris: use getpeerucred() */
- ucred_t *ucred;
-
- ucred = NULL; /* must be initialized to NULL */
- if (getpeerucred(sock, &ucred) == -1)
- return -1;
-
- *uid = ucred_geteuid(ucred);
- *gid = ucred_getegid(ucred);
- ucred_free(ucred);
-
- if (*uid == (uid_t) (-1) || *gid == (gid_t) (-1))
- return -1;
- return 0;
-#else
- /* No implementation available on this platform */
- errno = ENOSYS;
- return -1;
-#endif
-}
-#endif // HAVE_GETPEEREID
diff --git a/fallback.h b/fallback.h
index 6898ea576..eba91be6c 100644
--- a/fallback.h
+++ b/fallback.h
@@ -482,7 +482,3 @@ double nan(char *tagp);
#endif
-
-#ifndef HAVE_GETPEEREID
-int getpeereid(int sock, uid_t *uid, gid_t *gid);
-#endif
diff --git a/osx/config.h b/osx/config.h
index 1db2e52c4..99f837427 100644
--- a/osx/config.h
+++ b/osx/config.h
@@ -40,12 +40,6 @@
/* Define to 1 if you have the header file. */
#define HAVE_GETOPT_H 1
-/* Define to 1 if you have the `getpeereid' function. */
-#define HAVE_GETPEEREID 1
-
-/* Define to 1 if you have the `getpeerucred' function. */
-/* #undef HAVE_GETPEERUCRED */
-
/* Define to 1 if you have the `gettext' function. */
/* #undef HAVE_GETTEXT */
From 8844f0c142ade7d6dfea20fc65432b4f97fb92c9 Mon Sep 17 00:00:00 2001
From: David Adam
Date: Sun, 3 Aug 2014 18:45:03 +0800
Subject: [PATCH 6/9] Clarify I/O redirection documentation
Fix the examples and try and improve the clarity of the section.
Closes #1409.
---
doc_src/index.hdr.in | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index 758a597b8..a71bae4a1 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -168,16 +168,16 @@ default through a simple mechanism called a redirection.
An example of a file redirection is echo hello \>output.txt,
which directs the output of the echo command to the file output.txt.
-- To redirect standard input, write \
-- To redirect standard output, write \>DESTINATION
-- To redirect standard error, write ^DESTINATION
-- To redirect standard output to a file which will be appended, write \>\>DESTINATION_FILE
-- To redirect standard error to a file which will be appended, write ^^DESTINATION_FILE
+- To read standard input from a file, write \
+- To write standard output to a file, write \>DESTINATION
+- To write standard error to a file, write ^DESTINATION
+- To append standard output to a file, write \>\>DESTINATION_FILE
+- To append standard error to a file, write ^^DESTINATION_FILE
DESTINATION can be one of the following:
- A filename. The output will be written to the specified file.
-- An ampersand (\&) followed by the number of another file descriptor. The file descriptor will be a duplicate of the specified file descriptor.
+- An ampersand (\&) followed by the number of another file descriptor. The output will be written to that file descriptor instead.
- An ampersand followed by a minus sign (\&-). The file descriptor will be closed.
Example:
@@ -186,15 +186,16 @@ To redirect both standard output and standard error to the file
all_output.txt, you can write echo Hello \>all_output.txt
^\&1.
-Any FD can be redirected in an arbitrary way by prefixing the
-redirection with the number of the FD.
+Any file descriptor can be redirected in an arbitrary way by prefixing the
+redirection with the file descriptor.
-- To redirect input of FD number N, write N\
-- To redirect output of FD number N, write N\>DESTINATION
-- To redirect output of FD number N to a file which will be appended, write N\>\>DESTINATION_FILE
+- To redirect input of FD N, write N\
+- To redirect output of FD N, write N\>DESTINATION
+- To append the output of FD N to a file, write N\>\>DESTINATION_FILE
-Example: echo Hello 2\>- and echo Hello ^- are
-equivalent.
+Example: echo Hello 2\>output.stderr and echo Hello
+^output.stderr are equivalent, and write the standard error (file
+descriptor 2) of the target program to output.stderr.
\subsection piping Piping
From 4ae2753025311e9bcc9818dcc26b9e89f229b291 Mon Sep 17 00:00:00 2001
From: David Adam
Date: Mon, 4 Aug 2014 13:34:26 +0800
Subject: [PATCH 7/9] Authenticate connections to web_config service
- Require all requests to use a session path.
- Use a redirect file to avoid exposing the '/start' URL on the
command line, as it contains the cookie value.
Fix for CVE-2014-2914.
Closes #1438.
---
share/tools/web_config/js/controllers.js | 20 +++----
share/tools/web_config/webconfig.py | 69 ++++++++++++++++++++++--
2 files changed, 74 insertions(+), 15 deletions(-)
diff --git a/share/tools/web_config/js/controllers.js b/share/tools/web_config/js/controllers.js
index 7db84a35a..cc4452b55 100644
--- a/share/tools/web_config/js/controllers.js
+++ b/share/tools/web_config/js/controllers.js
@@ -83,7 +83,7 @@ controllers.controller("colorsController", function($scope, $http) {
$scope.getCurrentTheme = function() {
- $http.get("/colors/").success(function(data, status, headers, config) {
+ $http.get("colors/").success(function(data, status, headers, config) {
var currentScheme = { "name": "Current", "colors":[], "preferred_background": "" };
for (var i in data) {
currentScheme[data[i].name] = data[i].color;
@@ -103,7 +103,7 @@ controllers.controller("colorsController", function($scope, $http) {
var remaining = settingNames.length;
for (name in settingNames) {
var postData = "what=" + settingNames[name] + "&color=" + $scope.selectedColorScheme[settingNames[name]] + "&background_color=&bold=&underline=";
- $http.post("/set_color/", postData, { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
+ $http.post("set_color/", postData, { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
if (status == 200) {
remaining -= 1;
if (remaining == 0) {
@@ -124,7 +124,7 @@ controllers.controller("promptController", function($scope, $http) {
$scope.savePromptButtonTitle = "Set Prompt";
$scope.fetchSamplePrompts= function() {
- $http.get("/sample_prompts/").success(function(data, status, headers, config) {
+ $http.get("sample_prompts/").success(function(data, status, headers, config) {
$scope.samplePrompts = data;
$scope.samplePromptsArrayArray = get_colors_as_nested_array($scope.samplePrompts, 1);
@@ -140,7 +140,7 @@ controllers.controller("promptController", function($scope, $http) {
}
$scope.setNewPrompt = function(selectedPrompt) {
- $http.post("/set_prompt/","what=" + encodeURIComponent(selectedPrompt.function), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config){
+ $http.post("set_prompt/","what=" + encodeURIComponent(selectedPrompt.function), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config){
// Update attributes of current prompt and select it
$scope.samplePrompts[0].demo = selectedPrompt.demo;
@@ -171,7 +171,7 @@ controllers.controller("functionsController", function($scope, $http) {
}
$scope.fetchFunctions= function() {
- $http.get("/functions/").success(function(data, status, headers, config) {
+ $http.get("functions/").success(function(data, status, headers, config) {
$scope.functions = data;
$scope.selectFunction($scope.functions[0]);
})};
@@ -195,7 +195,7 @@ controllers.controller("functionsController", function($scope, $http) {
}
$scope.fetchFunctionDefinition = function(name) {
- $http.post("/get_function/","what=" + name, { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
+ $http.post("get_function/","what=" + name, { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
$scope.functionDefinition = $scope.cleanupFishFunction(data[0]);
})};
@@ -206,7 +206,7 @@ controllers.controller("variablesController", function($scope, $http) {
$scope.query = null;
$scope.fetchVariables= function() {
- $http.get("/variables/").success(function(data, status, headers, config) {
+ $http.get("variables/").success(function(data, status, headers, config) {
$scope.variables = data;
})};
@@ -247,7 +247,7 @@ controllers.controller("historyController", function($scope, $http, $timeout) {
}
// Get history from server
$scope.fetchHistory = function() {
- $http.get("/history/").success(function(data, status, headers, config) {
+ $http.get("history/").success(function(data, status, headers, config) {
$scope.historySize = data.length;
$scope.remainingItems = data;
@@ -257,7 +257,7 @@ controllers.controller("historyController", function($scope, $http, $timeout) {
$scope.deleteHistoryItem = function(item) {
index = $scope.historyItems.indexOf(item);
- $http.post("/delete_history_item/","what=" + encodeURIComponent(item), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
+ $http.post("delete_history_item/","what=" + encodeURIComponent(item), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
$scope.historyItems.splice(index, 1);
})};
@@ -278,7 +278,7 @@ controllers.controller("historyController", function($scope, $http, $timeout) {
controllers.controller("bindingsController", function($scope, $http) {
$scope.bindings = [];
$scope.fetchBindings = function() {
- $http.get("/bindings/").success(function(data, status, headers, config) {
+ $http.get("bindings/").success(function(data, status, headers, config) {
$scope.bindings = data;
})};
diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py
index c3daef5fe..55ab372ef 100755
--- a/share/tools/web_config/webconfig.py
+++ b/share/tools/web_config/webconfig.py
@@ -26,7 +26,7 @@ if term:
os.environ['TERM'] = term
import subprocess
-import re, socket, cgi, select, time, glob
+import re, socket, cgi, select, time, glob, random, string
try:
import json
except ImportError:
@@ -693,9 +693,16 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
else: font_size = '18pt'
return font_size
-
def do_GET(self):
p = self.path
+
+ authpath = '/' + authkey
+ if p.startswith(authpath):
+ p = p[len(authpath):]
+ else:
+ return self.send_error(403)
+ self.path = p
+
if p == '/colors/':
output = self.do_get_colors()
elif p == '/functions/':
@@ -727,6 +734,14 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_POST(self):
p = self.path
+
+ authpath = '/' + authkey
+ if p.startswith(authpath):
+ p = p[len(authpath):]
+ else:
+ return self.send_error(403)
+ self.path = p
+
if IS_PY2:
ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
else: # Python 3
@@ -788,6 +803,18 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
""" Disable request logging """
pass
+redirect_template_html = """
+
+
+
+
+
+
+ Start the Fish Web config
+
+
+"""
+
# find fish
fish_bin_dir = os.environ.get('__fish_bin_dir')
fish_bin_path = None
@@ -823,6 +850,9 @@ initial_wd = os.getcwd()
where = os.path.dirname(sys.argv[0])
os.chdir(where)
+# Generate a 16-byte random key as a hexadecimal string
+authkey = hex(random.getrandbits(16*4))[2:]
+
# Try to find a suitable port
PORT = 8000
while PORT <= 9000:
@@ -852,9 +882,36 @@ if len(sys.argv) > 1:
initial_tab = '#' + tab
break
-url = 'http://localhost:%d/%s' % (PORT, initial_tab)
-print("Web config started at '%s'. Hit enter to stop." % url)
-webbrowser.open(url)
+url = 'http://localhost:%d/%s/%s' % (PORT, authkey, initial_tab)
+
+# Create temporary file to hold redirect to real server
+# This prevents exposing the URL containing the authentication key on the command line
+# (see CVE-2014-2914 or https://github.com/fish-shell/fish-shell/issues/1438)
+if 'XDG_CACHE_HOME' in os.environ:
+ dirname = os.path.expanduser(os.path.expandvars('$XDG_CACHE_HOME/fish/'))
+else:
+ dirname = os.path.expanduser('~/.cache/fish/')
+
+os.umask(0o0077)
+try:
+ os.makedirs(dirname, 0o0700)
+except OSError as e:
+ if e.errno == 17:
+ pass
+ else:
+ raise e
+
+randtoken = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6))
+filename = dirname + 'web_config-%s.html' % randtoken
+
+f = open(filename, 'w')
+f.write(redirect_template_html % (url, url))
+f.close()
+
+# Open temporary file as URL
+fileurl = 'file://' + filename
+print("Web config started at '%s'. Hit enter to stop." % fileurl)
+webbrowser.open(fileurl)
# Select on stdin and httpd
stdin_no = sys.stdin.fileno()
@@ -871,3 +928,5 @@ try:
except KeyboardInterrupt:
print("\nShutting down.")
+# Clean up temporary file
+os.remove(filename)
From bcda3f1baa07576de45963722c4b3d8f9cb03ceb Mon Sep 17 00:00:00 2001
From: Gio d'Amelio
Date: Fri, 1 Aug 2014 15:55:36 -0700
Subject: [PATCH 8/9] Set $CMD_DURATION to milliseconds. Fixes #1585
---
doc_src/index.hdr.in | 1 +
reader.cpp | 30 ++----------------------------
2 files changed, 3 insertions(+), 28 deletions(-)
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index a71bae4a1..bf48bc459 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -1009,6 +1009,7 @@ values of most of these variables.
- \c PWD, the current working directory.
- \c status, the exit status of the last foreground job to exit. If the job was terminated through a signal, the exit status will be 128 plus the signal number.
- \c USER, the current username. This variable can only be changed by the root user.
+- \c CMD_DURATION, the runtime of the last command in milliseconds.
The names of these variables are mostly derived from the csh family of
shells and differ from the ones used by Bourne style shells such as
diff --git a/reader.cpp b/reader.cpp
index 2f1e6c2dc..057ab7067 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -2497,34 +2497,8 @@ void set_env_cmd_duration(struct timeval *after, struct timeval *before)
secs -= 1;
}
- if (secs < 1)
- {
- env_remove(ENV_CMD_DURATION, 0);
- }
- else
- {
- if (secs < 10) // 10 secs
- {
- swprintf(buf, 16, L"%lu.%02us", secs, usecs / 10000);
- }
- else if (secs < 60) // 1 min
- {
- swprintf(buf, 16, L"%lu.%01us", secs, usecs / 100000);
- }
- else if (secs < 600) // 10 mins
- {
- swprintf(buf, 16, L"%lum %lu.%01us", secs / 60, secs % 60, usecs / 100000);
- }
- else if (secs < 5400) // 1.5 hours
- {
- swprintf(buf, 16, L"%lum %lus", secs / 60, secs % 60);
- }
- else
- {
- swprintf(buf, 16, L"%.1fh", secs / 3600.0);
- }
- env_set(ENV_CMD_DURATION, buf, ENV_EXPORT);
- }
+ swprintf(buf, 16, L"%d", (secs * 1000) + (usecs / 1000));
+ env_set(ENV_CMD_DURATION, buf, ENV_EXPORT);
}
void reader_run_command(parser_t &parser, const wcstring &cmd)
From 33c714ca039126f3911fe39719d957c6deadef32 Mon Sep 17 00:00:00 2001
From: ridiculousfish
Date: Mon, 4 Aug 2014 12:29:05 -0700
Subject: [PATCH 9/9] Add fish_tests target to Xcode build
Allows running the tests in Xcode
---
fish.xcodeproj/project.pbxproj | 319 ++++++++----------
.../xcschemes/fish_tests.xcscheme | 93 +++++
fish_tests.cpp | 22 ++
3 files changed, 258 insertions(+), 176 deletions(-)
create mode 100644 fish.xcodeproj/xcshareddata/xcschemes/fish_tests.xcscheme
diff --git a/fish.xcodeproj/project.pbxproj b/fish.xcodeproj/project.pbxproj
index 0ed1dcd7e..566a221fd 100644
--- a/fish.xcodeproj/project.pbxproj
+++ b/fish.xcodeproj/project.pbxproj
@@ -55,6 +55,49 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ D00769121990137800CA4627 /* autoload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0C6FCC914CFA4B0004CE8AD /* autoload.cpp */; };
+ D00769131990137800CA4627 /* builtin_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0F3373A1506DE3C00ECEFC0 /* builtin_test.cpp */; };
+ D00769141990137800CA4627 /* color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0B6B0FE14E88BA400AD6C10 /* color.cpp */; };
+ D00769151990137800CA4627 /* common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853613B3ACEE0099B651 /* common.cpp */; };
+ D00769161990137800CA4627 /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853B13B3ACEE0099B651 /* event.cpp */; };
+ D00769171990137800CA4627 /* input_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854913B3ACEE0099B651 /* input_common.cpp */; };
+ D00769181990137800CA4627 /* io.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854C13B3ACEE0099B651 /* io.cpp */; };
+ D00769191990137800CA4627 /* iothread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854D13B3ACEE0099B651 /* iothread.cpp */; };
+ D007691A1990137800CA4627 /* parse_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855213B3ACEE0099B651 /* parse_util.cpp */; };
+ D007691B1990137800CA4627 /* path.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855513B3ACEE0099B651 /* path.cpp */; };
+ D007691C1990137800CA4627 /* parse_execution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D052D8091868F7FC003ABCBD /* parse_execution.cpp */; };
+ D007691D1990137800CA4627 /* postfork.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D09B1C1914FC7B5B00F91077 /* postfork.cpp */; };
+ D007691E1990137800CA4627 /* screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855A13B3ACEE0099B651 /* screen.cpp */; };
+ D007691F1990137800CA4627 /* signal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855C13B3ACEE0099B651 /* signal.cpp */; };
+ D00769201990137800CA4627 /* utf8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0C9733718DE5449002D7C81 /* utf8.cpp */; };
+ D00769211990137800CA4627 /* builtin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853513B3ACEE0099B651 /* builtin.cpp */; };
+ D00769221990137800CA4627 /* function.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854413B3ACEE0099B651 /* function.cpp */; };
+ D00769231990137800CA4627 /* complete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853713B3ACEE0099B651 /* complete.cpp */; };
+ D00769241990137800CA4627 /* env.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853A13B3ACEE0099B651 /* env.cpp */; };
+ D00769251990137800CA4627 /* exec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853C13B3ACEE0099B651 /* exec.cpp */; };
+ D00769261990137800CA4627 /* expand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853D13B3ACEE0099B651 /* expand.cpp */; };
+ D00769271990137800CA4627 /* fish_version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D00F63F019137E9D00FCCDEC /* fish_version.cpp */; };
+ D00769281990137800CA4627 /* highlight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854713B3ACEE0099B651 /* highlight.cpp */; };
+ D00769291990137800CA4627 /* history.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854813B3ACEE0099B651 /* history.cpp */; };
+ D007692A1990137800CA4627 /* kill.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854F13B3ACEE0099B651 /* kill.cpp */; };
+ D007692B1990137800CA4627 /* parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855413B3ACEE0099B651 /* parser.cpp */; };
+ D007692C1990137800CA4627 /* parser_keywords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855313B3ACEE0099B651 /* parser_keywords.cpp */; };
+ D007692D1990137800CA4627 /* proc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855713B3ACEE0099B651 /* proc.cpp */; };
+ D007692E1990137800CA4627 /* reader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855813B3ACEE0099B651 /* reader.cpp */; };
+ D007692F1990137800CA4627 /* sanity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855913B3ACEE0099B651 /* sanity.cpp */; };
+ D00769301990137800CA4627 /* tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855D13B3ACEE0099B651 /* tokenizer.cpp */; };
+ D00769311990137800CA4627 /* wildcard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0856013B3ACEE0099B651 /* wildcard.cpp */; };
+ D00769321990137800CA4627 /* wgetopt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855F13B3ACEE0099B651 /* wgetopt.cpp */; };
+ D00769331990137800CA4627 /* wutil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0856113B3ACEE0099B651 /* wutil.cpp */; };
+ D00769341990137800CA4627 /* input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854A13B3ACEE0099B651 /* input.cpp */; };
+ D00769351990137800CA4627 /* output.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855113B3ACEE0099B651 /* output.cpp */; };
+ D00769361990137800CA4627 /* intern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854B13B3ACEE0099B651 /* intern.cpp */; };
+ D00769371990137800CA4627 /* env_universal_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853813B3ACEE0099B651 /* env_universal_common.cpp */; };
+ D00769381990137800CA4627 /* pager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D03238891849D1980032CF2C /* pager.cpp */; };
+ D007693A1990137800CA4627 /* parse_tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0C52F351765284C00BFAB82 /* parse_tree.cpp */; };
+ D007693B1990137800CA4627 /* parse_productions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0FE8EE7179FB75F008C9F21 /* parse_productions.cpp */; };
+ D007693D1990137800CA4627 /* libncurses.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D02A8C15983CFA008E62BD /* libncurses.dylib */; };
+ D0076943199013B900CA4627 /* fish_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854113B3ACEE0099B651 /* fish_tests.cpp */; };
D00F63F119137E9D00FCCDEC /* fish_version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D00F63F019137E9D00FCCDEC /* fish_version.cpp */; };
D00F63F219137E9D00FCCDEC /* fish_version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D00F63F019137E9D00FCCDEC /* fish_version.cpp */; };
D01A2D24169B736200767098 /* man1 in Copy Files */ = {isa = PBXBuildFile; fileRef = D01A2D23169B730A00767098 /* man1 */; };
@@ -73,45 +116,6 @@
D07D266E15E33B86009E43F6 /* tools in Copy Files */ = {isa = PBXBuildFile; fileRef = D025C02915D1FEA100B9DB63 /* tools */; };
D07D267215E34171009E43F6 /* config.fish in Copy Files */ = {isa = PBXBuildFile; fileRef = D0CBD580159EE48F0024809C /* config.fish */; };
D0879AC816BF9AAB00E98E56 /* fish_term_icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = D0879AC616BF9A1A00E98E56 /* fish_term_icon.icns */; };
- D08A329417B4458D00F3A533 /* fish_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D08A329317B4458D00F3A533 /* fish_tests.cpp */; };
- D08A329517B445C200F3A533 /* function.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854413B3ACEE0099B651 /* function.cpp */; };
- D08A329617B445FD00F3A533 /* builtin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853513B3ACEE0099B651 /* builtin.cpp */; };
- D08A329717B4463B00F3A533 /* complete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853713B3ACEE0099B651 /* complete.cpp */; };
- D08A329817B4463B00F3A533 /* env.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853A13B3ACEE0099B651 /* env.cpp */; };
- D08A329917B4463B00F3A533 /* exec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853C13B3ACEE0099B651 /* exec.cpp */; };
- D08A329A17B4463B00F3A533 /* expand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853D13B3ACEE0099B651 /* expand.cpp */; };
- D08A329B17B4463B00F3A533 /* highlight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854713B3ACEE0099B651 /* highlight.cpp */; };
- D08A329C17B4463B00F3A533 /* history.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854813B3ACEE0099B651 /* history.cpp */; };
- D08A329D17B4463B00F3A533 /* kill.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854F13B3ACEE0099B651 /* kill.cpp */; };
- D08A329E17B4463B00F3A533 /* parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855413B3ACEE0099B651 /* parser.cpp */; };
- D08A329F17B4463B00F3A533 /* proc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855713B3ACEE0099B651 /* proc.cpp */; };
- D08A32A017B4463B00F3A533 /* reader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855813B3ACEE0099B651 /* reader.cpp */; };
- D08A32A117B4463B00F3A533 /* sanity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855913B3ACEE0099B651 /* sanity.cpp */; };
- D08A32A217B4463B00F3A533 /* tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855D13B3ACEE0099B651 /* tokenizer.cpp */; };
- D08A32A317B4463B00F3A533 /* wgetopt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855F13B3ACEE0099B651 /* wgetopt.cpp */; };
- D08A32A417B4463B00F3A533 /* wildcard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0856013B3ACEE0099B651 /* wildcard.cpp */; };
- D08A32A517B4463B00F3A533 /* wutil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0856113B3ACEE0099B651 /* wutil.cpp */; };
- D08A32A617B4464300F3A533 /* input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854A13B3ACEE0099B651 /* input.cpp */; };
- D08A32A717B446A300F3A533 /* autoload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0C6FCC914CFA4B0004CE8AD /* autoload.cpp */; };
- D08A32A817B446A300F3A533 /* builtin_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0F3373A1506DE3C00ECEFC0 /* builtin_test.cpp */; };
- D08A32A917B446A300F3A533 /* color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0B6B0FE14E88BA400AD6C10 /* color.cpp */; };
- D08A32AA17B446A300F3A533 /* common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853613B3ACEE0099B651 /* common.cpp */; };
- D08A32AB17B446A300F3A533 /* env_universal_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853813B3ACEE0099B651 /* env_universal_common.cpp */; };
- D08A32AD17B446A300F3A533 /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0853B13B3ACEE0099B651 /* event.cpp */; };
- D08A32AE17B446A300F3A533 /* input_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854913B3ACEE0099B651 /* input_common.cpp */; };
- D08A32AF17B446A300F3A533 /* intern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854B13B3ACEE0099B651 /* intern.cpp */; };
- D08A32B017B446A300F3A533 /* io.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854C13B3ACEE0099B651 /* io.cpp */; };
- D08A32B117B446A300F3A533 /* iothread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0854D13B3ACEE0099B651 /* iothread.cpp */; };
- D08A32B217B446A300F3A533 /* output.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855113B3ACEE0099B651 /* output.cpp */; };
- D08A32B317B446A300F3A533 /* parse_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855213B3ACEE0099B651 /* parse_util.cpp */; };
- D08A32B417B446A300F3A533 /* parser_keywords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855313B3ACEE0099B651 /* parser_keywords.cpp */; };
- D08A32B517B446A300F3A533 /* path.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855513B3ACEE0099B651 /* path.cpp */; };
- D08A32B617B446A300F3A533 /* postfork.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D09B1C1914FC7B5B00F91077 /* postfork.cpp */; };
- D08A32B717B446A300F3A533 /* screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855A13B3ACEE0099B651 /* screen.cpp */; };
- D08A32B817B446A300F3A533 /* signal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0A0855C13B3ACEE0099B651 /* signal.cpp */; };
- D08A32B917B446B100F3A533 /* parse_productions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0FE8EE7179FB75F008C9F21 /* parse_productions.cpp */; };
- D08A32BA17B446B100F3A533 /* parse_tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0C52F351765284C00BFAB82 /* parse_tree.cpp */; };
- D08A32BC17B4473B00F3A533 /* libncurses.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D02A8C15983CFA008E62BD /* libncurses.dylib */; };
D0A564FE168D23D800AF6161 /* man in CopyFiles */ = {isa = PBXBuildFile; fileRef = D0A564F1168D0BAB00AF6161 /* man */; };
D0A56501168D258300AF6161 /* man in Copy Files */ = {isa = PBXBuildFile; fileRef = D0A564F1168D0BAB00AF6161 /* man */; };
D0C52F371765284C00BFAB82 /* parse_tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0C52F351765284C00BFAB82 /* parse_tree.cpp */; };
@@ -282,15 +286,6 @@
name = "Copy Files";
runOnlyForDeploymentPostprocessing = 1;
};
- D08A328B17B4455100F3A533 /* CopyFiles */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = /usr/share/man/man1/;
- dstSubfolderSpec = 0;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 1;
- };
D0F019F015A977010034B3B1 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -325,6 +320,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ D00769421990137800CA4627 /* fish_tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fish_tests; sourceTree = BUILT_PRODUCTS_DIR; };
D00F63F019137E9D00FCCDEC /* fish_version.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish_version.cpp; sourceTree = ""; };
D01A2D23169B730A00767098 /* man1 */ = {isa = PBXFileReference; lastKnownFileType = text; name = man1; path = pages_for_manpath/man1; sourceTree = BUILT_PRODUCTS_DIR; };
D025C02715D1FEA100B9DB63 /* completions */ = {isa = PBXFileReference; lastKnownFileType = folder; name = completions; path = share/completions; sourceTree = ""; };
@@ -339,8 +335,6 @@
D07B247215BCC15700D4ADB4 /* add-shell */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "add-shell"; path = "build_tools/osx_package_scripts/add-shell"; sourceTree = ""; };
D07B247515BCC4BE00D4ADB4 /* install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = install.sh; path = osx/install.sh; sourceTree = ""; };
D0879AC616BF9A1A00E98E56 /* fish_term_icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = fish_term_icon.icns; path = osx/fish_term_icon.icns; sourceTree = ""; };
- D08A328D17B4455100F3A533 /* fish_tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fish_tests; sourceTree = BUILT_PRODUCTS_DIR; };
- D08A329317B4458D00F3A533 /* fish_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish_tests.cpp; sourceTree = ""; };
D09B1C1914FC7B5B00F91077 /* postfork.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = postfork.cpp; sourceTree = ""; };
D09B1C1A14FC7B5B00F91077 /* postfork.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = postfork.h; sourceTree = ""; };
D0A0850313B3ACEE0099B651 /* builtin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = builtin.h; sourceTree = ""; };
@@ -466,11 +460,11 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
- D08A328A17B4455100F3A533 /* Frameworks */ = {
+ D007693C1990137800CA4627 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- D08A32BC17B4473B00F3A533 /* libncurses.dylib in Frameworks */,
+ D007693D1990137800CA4627 /* libncurses.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -664,7 +658,6 @@
D0A0856613B3ACEE0099B651 /* xdgmimemagic.cpp */,
D0A0852F13B3ACEE0099B651 /* xdgmimeparent.h */,
D0A0856713B3ACEE0099B651 /* xdgmimeparent.cpp */,
- D08A329317B4458D00F3A533 /* fish_tests.cpp */,
);
name = Sources;
sourceTree = "";
@@ -704,7 +697,7 @@
D0D2693C159835CA005D9B9C /* fish */,
D0D02A9A15985A75008E62BD /* fish.app */,
D0D02AD01598642A008E62BD /* fish_indent */,
- D08A328D17B4455100F3A533 /* fish_tests */,
+ D00769421990137800CA4627 /* fish_tests */,
);
name = Products;
sourceTree = "";
@@ -737,21 +730,20 @@
/* End PBXLegacyTarget section */
/* Begin PBXNativeTarget section */
- D08A328C17B4455100F3A533 /* fish_tests */ = {
+ D00769101990137800CA4627 /* fish_tests */ = {
isa = PBXNativeTarget;
- buildConfigurationList = D08A329217B4455100F3A533 /* Build configuration list for PBXNativeTarget "fish_tests" */;
+ buildConfigurationList = D007693E1990137800CA4627 /* Build configuration list for PBXNativeTarget "fish_tests" */;
buildPhases = (
- D08A328917B4455100F3A533 /* Sources */,
- D08A328A17B4455100F3A533 /* Frameworks */,
- D08A328B17B4455100F3A533 /* CopyFiles */,
+ D00769111990137800CA4627 /* Sources */,
+ D007693C1990137800CA4627 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = fish_tests;
- productName = fish_tests;
- productReference = D08A328D17B4455100F3A533 /* fish_tests */;
+ productName = fish_Xcode;
+ productReference = D00769421990137800CA4627 /* fish_tests */;
productType = "com.apple.product-type.tool";
};
D0D02A9915985A75008E62BD /* fish.app */ = {
@@ -829,9 +821,9 @@
D0D02A9915985A75008E62BD /* fish.app */,
D0D2693B159835CA005D9B9C /* fish_shell */,
D0D02ACF1598642A008E62BD /* fish_indent */,
- D08A328C17B4455100F3A533 /* fish_tests */,
D0A564E6168CFDD800AF6161 /* man_pages */,
D0A084F713B3AC130099B651 /* Makefile */,
+ D00769101990137800CA4627 /* fish_tests */,
);
};
/* End PBXProject section */
@@ -1008,48 +1000,52 @@
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
- D08A328917B4455100F3A533 /* Sources */ = {
+ D00769111990137800CA4627 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- D08A32B917B446B100F3A533 /* parse_productions.cpp in Sources */,
- D08A32BA17B446B100F3A533 /* parse_tree.cpp in Sources */,
- D08A32A717B446A300F3A533 /* autoload.cpp in Sources */,
- D08A32A817B446A300F3A533 /* builtin_test.cpp in Sources */,
- D08A32A917B446A300F3A533 /* color.cpp in Sources */,
- D08A32AA17B446A300F3A533 /* common.cpp in Sources */,
- D08A32AB17B446A300F3A533 /* env_universal_common.cpp in Sources */,
- D08A32AD17B446A300F3A533 /* event.cpp in Sources */,
- D08A32AE17B446A300F3A533 /* input_common.cpp in Sources */,
- D08A32AF17B446A300F3A533 /* intern.cpp in Sources */,
- D08A32B017B446A300F3A533 /* io.cpp in Sources */,
- D08A32B117B446A300F3A533 /* iothread.cpp in Sources */,
- D08A32B217B446A300F3A533 /* output.cpp in Sources */,
- D08A32B317B446A300F3A533 /* parse_util.cpp in Sources */,
- D08A32B417B446A300F3A533 /* parser_keywords.cpp in Sources */,
- D08A32B517B446A300F3A533 /* path.cpp in Sources */,
- D08A32B617B446A300F3A533 /* postfork.cpp in Sources */,
- D08A32B717B446A300F3A533 /* screen.cpp in Sources */,
- D08A32B817B446A300F3A533 /* signal.cpp in Sources */,
- D08A32A617B4464300F3A533 /* input.cpp in Sources */,
- D08A329717B4463B00F3A533 /* complete.cpp in Sources */,
- D08A329817B4463B00F3A533 /* env.cpp in Sources */,
- D08A329917B4463B00F3A533 /* exec.cpp in Sources */,
- D08A329A17B4463B00F3A533 /* expand.cpp in Sources */,
- D08A329B17B4463B00F3A533 /* highlight.cpp in Sources */,
- D08A329C17B4463B00F3A533 /* history.cpp in Sources */,
- D08A329D17B4463B00F3A533 /* kill.cpp in Sources */,
- D08A329E17B4463B00F3A533 /* parser.cpp in Sources */,
- D08A329F17B4463B00F3A533 /* proc.cpp in Sources */,
- D08A32A017B4463B00F3A533 /* reader.cpp in Sources */,
- D08A32A117B4463B00F3A533 /* sanity.cpp in Sources */,
- D08A32A217B4463B00F3A533 /* tokenizer.cpp in Sources */,
- D08A32A317B4463B00F3A533 /* wgetopt.cpp in Sources */,
- D08A32A417B4463B00F3A533 /* wildcard.cpp in Sources */,
- D08A32A517B4463B00F3A533 /* wutil.cpp in Sources */,
- D08A329617B445FD00F3A533 /* builtin.cpp in Sources */,
- D08A329417B4458D00F3A533 /* fish_tests.cpp in Sources */,
- D08A329517B445C200F3A533 /* function.cpp in Sources */,
+ D00769121990137800CA4627 /* autoload.cpp in Sources */,
+ D00769131990137800CA4627 /* builtin_test.cpp in Sources */,
+ D00769141990137800CA4627 /* color.cpp in Sources */,
+ D00769151990137800CA4627 /* common.cpp in Sources */,
+ D00769161990137800CA4627 /* event.cpp in Sources */,
+ D00769171990137800CA4627 /* input_common.cpp in Sources */,
+ D00769181990137800CA4627 /* io.cpp in Sources */,
+ D00769191990137800CA4627 /* iothread.cpp in Sources */,
+ D007691A1990137800CA4627 /* parse_util.cpp in Sources */,
+ D007691B1990137800CA4627 /* path.cpp in Sources */,
+ D007691C1990137800CA4627 /* parse_execution.cpp in Sources */,
+ D007691D1990137800CA4627 /* postfork.cpp in Sources */,
+ D007691E1990137800CA4627 /* screen.cpp in Sources */,
+ D007691F1990137800CA4627 /* signal.cpp in Sources */,
+ D00769201990137800CA4627 /* utf8.cpp in Sources */,
+ D00769211990137800CA4627 /* builtin.cpp in Sources */,
+ D00769221990137800CA4627 /* function.cpp in Sources */,
+ D00769231990137800CA4627 /* complete.cpp in Sources */,
+ D00769241990137800CA4627 /* env.cpp in Sources */,
+ D00769251990137800CA4627 /* exec.cpp in Sources */,
+ D00769261990137800CA4627 /* expand.cpp in Sources */,
+ D00769271990137800CA4627 /* fish_version.cpp in Sources */,
+ D00769281990137800CA4627 /* highlight.cpp in Sources */,
+ D00769291990137800CA4627 /* history.cpp in Sources */,
+ D007692A1990137800CA4627 /* kill.cpp in Sources */,
+ D007692B1990137800CA4627 /* parser.cpp in Sources */,
+ D007692C1990137800CA4627 /* parser_keywords.cpp in Sources */,
+ D007692D1990137800CA4627 /* proc.cpp in Sources */,
+ D007692E1990137800CA4627 /* reader.cpp in Sources */,
+ D007692F1990137800CA4627 /* sanity.cpp in Sources */,
+ D00769301990137800CA4627 /* tokenizer.cpp in Sources */,
+ D00769311990137800CA4627 /* wildcard.cpp in Sources */,
+ D00769321990137800CA4627 /* wgetopt.cpp in Sources */,
+ D00769331990137800CA4627 /* wutil.cpp in Sources */,
+ D00769341990137800CA4627 /* input.cpp in Sources */,
+ D00769351990137800CA4627 /* output.cpp in Sources */,
+ D00769361990137800CA4627 /* intern.cpp in Sources */,
+ D00769371990137800CA4627 /* env_universal_common.cpp in Sources */,
+ D00769381990137800CA4627 /* pager.cpp in Sources */,
+ D007693A1990137800CA4627 /* parse_tree.cpp in Sources */,
+ D007693B1990137800CA4627 /* parse_productions.cpp in Sources */,
+ D0076943199013B900CA4627 /* fish_tests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1165,6 +1161,42 @@
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
+ D007693F1990137800CA4627 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ PRODUCT_NAME = fish_tests;
+ };
+ name = Debug;
+ };
+ D00769401990137800CA4627 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ PRODUCT_NAME = fish_tests;
+ };
+ name = Release;
+ };
+ D00769411990137800CA4627 /* Release_C++11 */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ PRODUCT_NAME = fish_tests;
+ };
+ name = "Release_C++11";
+ };
D007FDDA17136EAA00A52BE6 /* Release_C++11 */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -1295,71 +1327,6 @@
};
name = Release;
};
- D08A328F17B4455100F3A533 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_OBJC_EXCEPTIONS = YES;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.8;
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = Debug;
- };
- D08A329017B4455100F3A533 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_ENABLE_OBJC_EXCEPTIONS = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.8;
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = Release;
- };
- D08A329117B4455100F3A533 /* Release_C++11 */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_ENABLE_OBJC_EXCEPTIONS = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.8;
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = "Release_C++11";
- };
D0A084F813B3AC130099B651 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -1572,6 +1539,16 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ D007693E1990137800CA4627 /* Build configuration list for PBXNativeTarget "fish_tests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ D007693F1990137800CA4627 /* Debug */,
+ D00769401990137800CA4627 /* Release */,
+ D00769411990137800CA4627 /* Release_C++11 */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
D07D266F15E33B86009E43F6 /* Build configuration list for PBXAggregateTarget "install_tree" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -1582,16 +1559,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- D08A329217B4455100F3A533 /* Build configuration list for PBXNativeTarget "fish_tests" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- D08A328F17B4455100F3A533 /* Debug */,
- D08A329017B4455100F3A533 /* Release */,
- D08A329117B4455100F3A533 /* Release_C++11 */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
D0A084F513B3AC130099B651 /* Build configuration list for PBXProject "fish" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/fish.xcodeproj/xcshareddata/xcschemes/fish_tests.xcscheme b/fish.xcodeproj/xcshareddata/xcschemes/fish_tests.xcscheme
new file mode 100644
index 000000000..0cb68e5a0
--- /dev/null
+++ b/fish.xcodeproj/xcshareddata/xcschemes/fish_tests.xcscheme
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/fish_tests.cpp b/fish_tests.cpp
index 08ab8477c..960931542 100644
--- a/fish_tests.cpp
+++ b/fish_tests.cpp
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -732,6 +733,10 @@ static void test_1_cancellation(const wchar_t *src)
static void test_cancellation()
{
+ if (getenv("RUNNING_IN_XCODE")) {
+ say(L"Skipping Ctrl-C cancellation test because we are running in Xcode debugger");
+ return;
+ }
say(L"Testing Ctrl-C cancellation. If this hangs, that's a bug!");
/* Enable fish's signal handling here. We need to make this interactive for fish to install its signal handlers */
@@ -3516,6 +3521,23 @@ static void test_highlighting(void)
*/
int main(int argc, char **argv)
{
+ // Look for the file tests/test.fish. We expect to run in a directory containing that file.
+ // If we don't find it, walk up the directory hierarchy until we do, or error
+ while (access("./tests/test.fish", F_OK) != 0)
+ {
+ char wd[PATH_MAX + 1] = {};
+ getcwd(wd, sizeof wd);
+ if (! strcmp(wd, "/"))
+ {
+ fprintf(stderr, "Unable to find 'tests' directory, which should contain file test.fish\n");
+ exit(EXIT_FAILURE);
+ }
+ if (chdir(dirname(wd)) < 0)
+ {
+ perror("chdir");
+ }
+ }
+
setlocale(LC_ALL, "");
//srand(time(0));
configure_thread_assertions_for_testing();