diff --git a/fish.spec b/fish.spec
index 6566c7b..5eae95c 100644
--- a/fish.spec
+++ b/fish.spec
@@ -1,6 +1,6 @@
 Name:                   fish
 Version:                2.2.0
-Release:                3%{?dist}
+Release:                4%{?dist}
 Summary:                A friendly interactive shell
 
 Group:                  System Environment/Shells
@@ -9,6 +9,11 @@ URL:                    http://fishshell.com/
 Source0:                http://fishshell.com/files/%{version}/fish-%{version}.tar.gz
 
 Patch0:                 fish-use-usrbinpython3.patch
+
+# Pull request #2393, hopefully fixing #2392 / rhbz #1263052
+Patch1:			pr-2393-1.patch
+Patch2:			pr-2393-2.patch
+
 BuildRequires:		python3-devel
 %global __python %{__python3}
 
@@ -24,6 +29,8 @@ nothing to learn or configure.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p2
+%patch2 -p2
 
 # This is unused.  If we fiddle with Python versions, its presence will
 # be confusing.
@@ -87,6 +94,9 @@ fi
 
 
 %changelog
+* Thu Sep 24 2015 Andy Lutomirski <luto@mit.edu> - 2.2.0-4
+- Hopefully fix rhbz #1263052 / upstream #2393
+
 * Thu Aug 20 2015 Andy Lutomirski <luto@mit.edu> - 2.2.0-3
 - Re-enable tests
 
diff --git a/pr-2393-1.patch b/pr-2393-1.patch
new file mode 100644
index 0000000..d9fe558
--- /dev/null
+++ b/pr-2393-1.patch
@@ -0,0 +1,43 @@
+commit 890f35cbcb28440c7e6c74055a77e3474c39fc3e
+Author: Andy Lutomirski <luto@kernel.org>
+Date:   Tue Sep 15 18:24:11 2015 -0700
+
+    Don't complain if do_builtin_io fails due to EPIPE
+    
+    If stdio is dead due to EPIPE, there's no great reason to spew a stack dump.
+    
+    This will still write an error to stderr if stdout dies.  This might be
+    undesirable, but changing that should be considered separately.
+
+diff --git a/src/exec.cpp b/src/exec.cpp
+index 39385b06a432..d7ff483bda3b 100644
+--- a/src/exec.cpp
++++ b/src/exec.cpp
+@@ -1161,7 +1161,7 @@ void exec_job(parser_t &parser, job_t *j)
+                             const std::string outbuff = wcs2string(out);
+                             const std::string errbuff = wcs2string(err);
+                             bool builtin_io_done = do_builtin_io(outbuff.data(), outbuff.size(), errbuff.data(), errbuff.size());
+-                            if (! builtin_io_done)
++                            if (! builtin_io_done && errno != EPIPE)
+                             {
+                                 show_stackframe();
+                             }
+diff --git a/src/postfork.cpp b/src/postfork.cpp
+index 1eb958ad9f0d..29cf850ca3d6 100644
+--- a/src/postfork.cpp
++++ b/src/postfork.cpp
+@@ -569,12 +569,13 @@ bool do_builtin_io(const char *out, size_t outlen, const char *err, size_t errle
+     bool success = true;
+     if (out && outlen)
+     {
+-
+         if (write_loop(STDOUT_FILENO, out, outlen) < 0)
+         {
++            int e = errno;
+             debug_safe(0, "Error while writing to stdout");
+             safe_perror("write_loop");
+             success = false;
++            errno = e;
+         }
+     }
+ 
diff --git a/pr-2393-2.patch b/pr-2393-2.patch
new file mode 100644
index 0000000..f2f9129
--- /dev/null
+++ b/pr-2393-2.patch
@@ -0,0 +1,33 @@
+commit 2d1a32ab4b0ce488726dd8929c85840dc73ed7dd
+Author: Andy Lutomirski <luto@kernel.org>
+Date:   Tue Sep 15 18:27:52 2015 -0700
+
+    Switch show_stackframe to backtrace_symbols_fd
+    
+    It's simpler and avoids calling into fprintf in contexts in which
+    it might crash or deadlock.
+
+diff --git a/src/common.cpp b/src/common.cpp
+index 78d0e23865c5..f5eb2ca5b921 100644
+--- a/src/common.cpp
++++ b/src/common.cpp
+@@ -90,17 +90,8 @@ void show_stackframe()
+     int trace_size = 0;
+ 
+     trace_size = backtrace(trace, 32);
+-    char **messages = backtrace_symbols(trace, trace_size);
+-
+-    if (messages)
+-    {
+-        debug(0, L"Backtrace:");
+-        for (int i=0; i<trace_size; i++)
+-        {
+-            fwprintf(stderr, L"%s\n", messages[i]);
+-        }
+-        free(messages);
+-    }
++    debug(0, L"Backtrace:");
++    backtrace_symbols_fd(trace, trace_size, STDERR_FILENO);
+ }
+ 
+ int fgetws2(wcstring *s, FILE *f)