http://lists.gnu.org/archive/html/bug-zile/2011-08/msg00030.html --- zile-2.3.24-orig/src/file.c +++ zile-2.3.24/src/file.c @@ -177,14 +177,15 @@ compact_path (astr path) { /* Replace `/userhome/' (if found) with `~/'. */ size_t homelen = strlen (pw->pw_dir); - if (astr_len (path) >= homelen && - !strncmp (pw->pw_dir, astr_cstr (path), homelen)) + if (homelen > 0 && pw->pw_dir[homelen - 1] == '/') + homelen--; + + if (astr_len (path) > homelen && + !strncmp (pw->pw_dir, astr_cstr (path), homelen) && + astr_get (path, homelen) == '/') { astr buf = astr_new_cstr ("~/"); - if (STREQ (pw->pw_dir, "/")) - astr_cat_cstr (buf, astr_cstr (path) + 1); - else - astr_cat_cstr (buf, astr_cstr (path) + homelen + 1); + astr_cat_cstr (buf, astr_cstr (path) + homelen + 1); astr_cpy (path, buf); astr_delete (buf); }