# Is the error 1:1 no such buffer message an invalid issue?

**URL:** <https://discuss.kakoune.com/t/is-the-error-1-1-no-such-buffer-message-an-invalid-issue/565>\
**Category:** Complaints & Improvements\
**Created:** [May 13, 2019, 5:54am UTC](https://discuss.kakoune.com/t/is-the-error-1-1-no-such-buffer-message-an-invalid-issue/565 "2019-05-13T05:54:37Z")\
**Posts on this page:** 1\
**Showing post:** 29

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [May 17, 2019, 9:59pm UTC](https://discuss.kakoune.com/t/is-the-error-1-1-no-such-buffer-message-an-invalid-issue/565/29 "2019-05-17T21:59:27Z")

</div>

I did a toy patch to fix this, it removes any slashes at the end of $HOME during the compact\_path and handles multiple slashes in the way @andreyorst said it should (won’t strip just one at the end, but as many as are there).

```diff
diff --git i/src/file.cc w/src/file.cc
index 52a0f288..0be76e58 100644
--- i/src/file.cc
+++ w/src/file.cc
@@ -86,7 +86,7 @@ String real_path(StringView filename)
                 return res;

             StringView dir = res;
- if (dir.substr(dir.length()-1_byte, 1_byte) == "/")
+ while (dir.substr(dir.length()-1_byte, 1_byte) == "/")
                 dir = dir.substr(0_byte, dir.length()-1_byte);
             return format("{}/{}", dir, non_existing);
         }
@@ -115,9 +115,13 @@ String compact_path(StringView filename)
     if (prefix_match(real_filename, real_cwd))
         return real_filename.substr(real_cwd.length()).str();

- const StringView home = homedir();
+ StringView home = homedir();
+
     if (not home.empty())
     {
+ while (home.substr(home.length()-1_byte, 1_byte) == "/")
+ home = home.substr(0_byte, home.length()-1_byte);
+
         ByteCount home_len = home.length();
         if (real_filename.substr(0, home_len) == home)
             return "~" + real_filename.substr(home_len);
@@ -405,7 +409,7 @@ String find_file(StringView filename, StringView buf_dir, ConstArrayView<String>
     {
         if (stat(filename.zstr(), &buf) == 0 and S_ISREG(buf.st_mode))
             return filename.str();
- return "";
+ return "";
     }
     if (filename.substr(0_byte, 2_byte) == "~/")
     {

```

---

_[View the full topic](https://discuss.kakoune.com/t/is-the-error-1-1-no-such-buffer-message-an-invalid-issue/565)._
