Allows browsing nonexistent folders as if they were empty

Bug #1022934 reported by Sergey "Shnatsel" Davidoff on 2012-07-10
30
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Files
Fix Released
Medium
Jeremy Wootten

Bug Description

Files lets me open any non-existent folder in it and view it as if it were empty. On attempting to copy something there it throws an error.
It should display a notice that the folder doesn't exist and maybe provide an option to create it too.

Related branches

Cody Garver (codygarver) on 2012-08-12
Changed in pantheon-files:
status: New → Confirmed
importance: Undecided → Medium

Targeting to beta2 because it's a more generic solution to bug 1065512 which was targeted to beta2.

Changed in pantheon-files:
milestone: none → luna-beta2
Daniel Fore (danrabbit) on 2012-12-23
Changed in pantheon-files:
milestone: luna-beta2 → luna-beta3
Julián Unrrein (junrrein) wrote :

Oddly enough, the necessary bits to correct this behavior already exist, but they are only triggered when trying to access a nonexistent folder which has the same name as any file under the current directory. And even then, it works only once. See the screen cast attached.

Julián Unrrein (junrrein) wrote :

For developers/people in the elementary team: I put up some sort of to-do list about this issue at https://docs.google.com/document/d/1ExQQkGt2js04lTtvJVDeuV-wPXhZiqYAEs3DdgRuVKI/edit?usp=sharing

Changed in pantheon-files:
assignee: nobody → Julián Unrrein (junrrein)
status: Confirmed → In Progress
Julián Unrrein (junrrein) wrote :

From duplicate bug report:

Reproducing:
1.Open Files
2. Click at the empty space in the Path bar
3. Type any letter combination
4. Press Enter. The folder will be opened even if it doesn't exist.
If you'll try to create a new file or to copy one there, you'll get copying error.

Correct behaviour:
Files App must write an error like 'Folder doesn't exist' when trying to reproduce step 4.

Changed in pantheon-files:
status: In Progress → Confirmed
Changed in pantheon-files:
assignee: Julián Unrrein (junrrein) → nobody
Jeremy Wootten (jeremywootten) wrote :

This is a simple fix that uses the existing "DirectoryNotFound" class when a non-existing location is entered on the command line or the location bar.

Julián Unrrein (junrrein) wrote :

Hi Jeremy.

Your fix is, in principle, the same as one I did earlier this year (https://docs.google.com/document/d/1ExQQkGt2js04lTtvJVDeuV-wPXhZiqYAEs3DdgRuVKI/edit?usp=sharing).
I suggest you take a look at what I did. Some of the bugs/quirks I already took care of may be still be present in your patch.

Hello Julián

Thanks for this. I saw your "simple fix" branch because it is listed as a
related branch against this bug, but I did not see this one. I'll have a
look at it and investigate the bugs you mentioned.

On 2 June 2013 15:25, Julián Unrrein <email address hidden> wrote:

> Hi Jeremy.
>
> Your fix is, in principle, the same as one I did earlier this year (
> https://docs.google.com/document/d/1ExQQkGt2js04lTtvJVDeuV-wPXhZiqYAEs3DdgRuVKI/edit?usp=sharing
> ).
> I suggest you take a look at what I did. Some of the bugs/quirks I already
> took care of may be still be present in your patch.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1022934
>
> Title:
> Allows browsing nonexistent folders as if they were empty
>
> Status in Files:
> Confirmed
>
> Bug description:
> Files lets me open any non-existent folder in it and view it as if it
> were empty. On attempting to copy something there it throws an error.
> It should display a notice that the folder doesn't exist and maybe
> provide an option to create it too.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pantheon-files/+bug/1022934/+subscriptions
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Jeremy Wootten (jeremywootten) wrote :

Hello Julián

I downloaded your fix-1022934 branch but it did not build with the error:

.../fix-1022934/build/src/View/Window.c:1327:41: error:
‘FM_DIRECTORY_TYPE_VIEW’ undeclared (first use in this function)

I could not reproduce the bugs you mentioned on the current branch (with my
fix 1022934 applied). Your bug is similar to my later bug 1184104, which
is still alive in the current branch but I have submitted a patch.

On 2 June 2013 15:25, Julián Unrrein <email address hidden> wrote:

> Hi Jeremy.
>
> Your fix is, in principle, the same as one I did earlier this year (
> https://docs.google.com/document/d/1ExQQkGt2js04lTtvJVDeuV-wPXhZiqYAEs3DdgRuVKI/edit?usp=sharing
> ).
> I suggest you take a look at what I did. Some of the bugs/quirks I already
> took care of may be still be present in your patch.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1022934
>
> Title:
> Allows browsing nonexistent folders as if they were empty
>
> Status in Files:
> Confirmed
>
> Bug description:
> Files lets me open any non-existent folder in it and view it as if it
> were empty. On attempting to copy something there it throws an error.
> It should display a notice that the folder doesn't exist and maybe
> provide an option to create it too.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pantheon-files/+bug/1022934/+subscriptions
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Julián Unrrein (junrrein) wrote :

Hi Jeremy,

It's unfortunate that my branch fails to build nowadays. It may be necessary to merge and commit changes from trunk first.

If you can't reproduce any of the crashes, then it's excellent!

But are you sure that all of the issues I mention in the GDoc are solved with your patch?
In particular:

"4) If there is more than one level of nonexistent folders - e.g. trying to access /home/julian/omg/wth/ but neither “omg” nor “wth” exist - the creation of “wth” fails, because “omg” doesn't exist. Files should create all the necessary folders at this step.

5) Use Granite's Welcome Screen.

6) When this view is active, attempting to reach another non-existent folder below the current non-existent one will leave the location bar in a weird state. When creating this other folder or going back to another one, the location bar goes back to normal."

Number 5, while technically not being an issue, it's very easy to implement.
For number 5, see http://bazaar.launchpad.net/~junrrein/pantheon-files/fix-1022934/revision/1097 (ignore the changes to src/View/ViewContainer.vala ).
For number 4, see http://bazaar.launchpad.net/~junrrein/pantheon-files/fix-1022934/revision/1098. While this works, it never frees the memory allocated in line 6361 in libcore/marlin-file-operations.c .

While I didn't try your patch, can you verify that creating a directory using your patch doesn't duplicate that dir's entry in the back button's history? This doesn't matter very much and can be fixed later, but just for the record.

Nice work finding and fixing bug 1184104!

And finally, thanks for your commitment!

Jeremy Wootten (jeremywootten) wrote :

Hello Julián

I will look at these bugs more closely and get back to you.

On 5 June 2013 20:38, Julián Unrrein <email address hidden> wrote:

> Hi Jeremy,
>
> It's unfortunate that my branch fails to build nowadays. It may be
> necessary to merge and commit changes from trunk first.
>
> If you can't reproduce any of the crashes, then it's excellent!
>
> But are you sure that all of the issues I mention in the GDoc are solved
> with your patch?
> In particular:
>
> "4) If there is more than one level of nonexistent folders - e.g. trying
> to access /home/julian/omg/wth/ but neither “omg” nor “wth” exist - the
> creation of “wth” fails, because “omg” doesn't exist. Files should
> create all the necessary folders at this step.
>
> 5) Use Granite's Welcome Screen.
>
> 6) When this view is active, attempting to reach another non-existent
> folder below the current non-existent one will leave the location bar in
> a weird state. When creating this other folder or going back to another
> one, the location bar goes back to normal."
>
> Number 5, while technically not being an issue, it's very easy to
> implement.
> For number 5, see
> http://bazaar.launchpad.net/~junrrein/pantheon-files/fix-1022934/revision/1097(ignore the changes to src/View/ViewContainer.vala ).
> For number 4, see
> http://bazaar.launchpad.net/~junrrein/pantheon-files/fix-1022934/revision/1098.
> While this works, it never frees the memory allocated in line 6361 in
> libcore/marlin-file-operations.c .
>
> While I didn't try your patch, can you verify that creating a directory
> using your patch doesn't duplicate that dir's entry in the back button's
> history? This doesn't matter very much and can be fixed later, but just
> for the record.
>
> Nice work finding and fixing bug 1184104!
>
> And finally, thanks for your commitment!
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1022934
>
> Title:
> Allows browsing nonexistent folders as if they were empty
>
> Status in Files:
> Confirmed
>
> Bug description:
> Files lets me open any non-existent folder in it and view it as if it
> were empty. On attempting to copy something there it throws an error.
> It should display a notice that the folder doesn't exist and maybe
> provide an option to create it too.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pantheon-files/+bug/1022934/+subscriptions
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Julián Unrrein (junrrein) wrote :

I tested your patch, and I found out that items number 1, 2 and 6 lined in my GDoc still happen.

Julián Unrrein (junrrein) wrote :

Hey Jeremy, my fix-1022934 branch builds just fine on my machine, but Files fails to open since it can't find some kind of setting in the schema:

[GLib-GIO] Settings schema 'org.pantheon.files.preferences' does not contain a key named 'toolbar-primary-css-style'

I believe it is caused by a change in trunk that changed the settings schema. I will try merging changes from trunk to see if I can make it run.

Julián Unrrein (junrrein) wrote :

My branch is now updated to match trunk as of today. I tested and it builds and runs fine. Happy hacking!

https://code.launchpad.net/~junrrein/pantheon-files/fix-1022934/

Julián Unrrein (junrrein) wrote :

In fact, I notice my branch behaves pretty well, with no crashes. I will go ahead and propose it for merging.

Changed in pantheon-files:
assignee: nobody → Julián Unrrein (junrrein)
Jeremy Wootten (jeremywootten) wrote :

Hello Julián

You are right my initial patch only addressed the immediate problem - not all the issues you pointed out. I have also produced a new patch (sorry - I didn't realise you had restarted work on yours) which seems to address these issues. Rather than use recursion I changed DirectoryNotFound.vala to use the GLib.File.make_directory_with_parents function, which seems simpler.

Other small differences:

1) Option to cancel and return to last existing parent
2) Welcome screen shows full path to be created not just the last folder
3) Browser only records directories that actually exist so you cannot browse back to a non-existing directory.

The fix is at:

lp:~jeremywootten/pantheon-files/fix-1022934

and I have attached a diff.

Julián Unrrein (junrrein) wrote :

Thank you, and don't apologise. We can work together on this one.

I didn't use GLib.File.make_directory_with_parents deliberately, because it isn't asynchronous, meaning that it will lock the UI until the operation is over. This doesn't seem to be a dealbreaker at first, until you account for creating folders over slow network drives, which could cause a period of unresponsiveness.

As for the other items, I will look into them and try to incorporate them in my branch - with the due credit, of course!

Julián Unrrein (junrrein) wrote :

I recommend not to show the full path to folders, because Granite's Welcome Screen doesn't wrap text to new lines. See the attachment.

Jeremy Wootten (jeremywootten) wrote :

Good point.

I have pushed a revision to
lp:~jeremywootten/pantheon-files/fix-1022934<https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1022934>
with
a compromise solution showing only the part of the path that will be
created rather than the full path (prefixed with .../).

If someone wants to create a directory with a very long name then this
could be a problem even if only the directory name is shown (if you want to
use the Granite Welcome Screen rather than a custom one).

It still feels better to me to show exactly what is being created rather
than just the last folder.

On 7 June 2013 14:56, Julián Unrrein <email address hidden> wrote:

> I recommend not to show the full path to folders, because Granite's
> Welcome Screen doesn't wrap text to new lines. See the attachment.
>
> ** Attachment added: "Captura de pantalla de 2013-06-07 10:54:01.png"
>
> https://bugs.launchpad.net/pantheon-files/+bug/1022934/+attachment/3697258/+files/Captura%20de%20pantalla%20de%202013-06-07%2010%3A54%3A01.png
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1022934
>
> Title:
> Allows browsing nonexistent folders as if they were empty
>
> Status in Files:
> Confirmed
>
> Bug description:
> Files lets me open any non-existent folder in it and view it as if it
> were empty. On attempting to copy something there it throws an error.
> It should display a notice that the folder doesn't exist and maybe
> provide an option to create it too.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pantheon-files/+bug/1022934/+subscriptions
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Jeremy Wootten (jeremywootten) wrote :

I must admit I did not consider this - I haven't experienced network drives
slow enough to cause a significant delay - but if this is a possibility
then an asynchronous solution would be better.

On 7 June 2013 14:12, Julián Unrrein <email address hidden> wrote:

> Thank you, and don't apologise. We can work together on this one.
>
> I didn't use GLib.File.make_directory_with_parents deliberately, because
> it isn't asynchronous, meaning that it will lock the UI until the
> operation is over. This doesn't seem to be a dealbreaker at first, until
> you account for creating folders over slow network drives, which could
> cause a period of unresponsiveness.
>
> As for the other items, I will look into them and try to incorporate
> them in my branch - with the due credit, of course!
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1022934
>
> Title:
> Allows browsing nonexistent folders as if they were empty
>
> Status in Files:
> Confirmed
>
> Bug description:
> Files lets me open any non-existent folder in it and view it as if it
> were empty. On attempting to copy something there it throws an error.
> It should display a notice that the folder doesn't exist and maybe
> provide an option to create it too.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pantheon-files/+bug/1022934/+subscriptions
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Julián Unrrein (junrrein) wrote :

I will forward this exchange to the reviewers of my branch, so we can have their opinion.

Cody Garver (codygarver) on 2013-06-14
Changed in pantheon-files:
milestone: 0.3-beta1 → luna-rc1
assignee: Julián Unrrein (junrrein) → Jeremy Wootten (jeremywootten)
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers