Accept ~ in U1Db database path to support config folder

Bug #1387294 reported by Michał Karnicki
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
U1DB Qt/ QML
New
Undecided
Unassigned

Bug Description

Similar to:
https://bugs.launchpad.net/u1db/+bug/907710

but can't expand home dir from QML. So, to me, the decision to close the bug wasn't correct.

See:
http://bazaar.launchpad.net/~uonedb-qt/u1db-qt/trunk/view/head:/src/database.cpp#L143

In Telegram, we'd like to use ~/.config/<app package>/foo.u1db -- from QML.

PS Please don't point me to
http://stackoverflow.com/questions/16408691/get-home-and-or-username-in-qml - it's a pain.

Related branches

Revision history for this message
Michał Karnicki (karni) wrote :

Lucio - I gather you'll now where to redirect this :)

Changed in u1db:
assignee: nobody → Lucio Torre (lucio.torre)
Changed in libqtelegram:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Michał Karnicki (karni)
Changed in u1db:
status: New → In Progress
assignee: Lucio Torre (lucio.torre) → Giulio Collura (gcollura)
affects: u1db → u1db-qt
Changed in u1db-qt:
status: In Progress → Fix Committed
Cris Dywan (kalikiana)
Changed in u1db-qt:
status: Fix Committed → In Progress
Revision history for this message
Cris Dywan (kalikiana) wrote :

I think it's important to point out that you want the user's config folder. You don't actually need their home.

summary: - u1db should accept ~ in database path
+ Accept ~ in U1Db database path to support config folder
Revision history for this message
Michał Karnicki (karni) wrote :

I don't think you should make that decision for the developer. I may want to create u1db docs in .cache or .local/share/ if I really want to. Don't force me to using ~/.config (even though that's what we'll go for in this particular case of Telegram).

Revision history for this message
Cris Dywan (kalikiana) wrote :

That's not in fact what I wanted to suggest, apologies for the confusion - I wanted to clarify the context of this bug because "support for ~" is too vague to come up with a better solution. My rule of thumb for good bugs: tell me what you want to achieve, not how ;-)

Revision history for this message
Michał Karnicki (karni) wrote :

Ah, I see. Thank you for the clarification :)

On a related note - by setting the bug to "in progress" -- would you consider Giulio's MP is not good?

Revision history for this message
Giulio Collura (gcollura) wrote : Re: [Bug 1387294] Re: Accept ~ in U1Db database path to support config folder

As I suggested on the merge request comment thread, a solution would be
allow the developer to choose in which destionation the database can be
placed. Since the places allowed by apparmor are limited (I think only
~/.config, ~/.local/share and ~/.cache are available, correct me if wrong),
we could provide an option to choose which one will be used by u1db and
translated accordingly in the correct path. This would avoid the use of ~
and other hardcoded path from the qml side. What do you think about this?

Giulio

On Thursday, October 30, 2014, Michał Karnicki <
<email address hidden>> wrote:
> Ah, I see. Thank you for the clarification :)
>
> On a related note - by setting the bug to "in progress" -- would you
> consider Giulio's MP is not good?
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1387294
>
> Title:
> Accept ~ in U1Db database path to support config folder
>
> Status in Libqtelegram - a qt library to access telegram.:
> Confirmed
> Status in U1DB Qt/ QML:
> In Progress
>
> Bug description:
> Similar to:
> https://bugs.launchpad.net/u1db/+bug/907710
>
> but can't expand home dir from QML. So, to me, the decision to close
> the bug wasn't correct.
>
> See:
>
http://bazaar.launchpad.net/~uonedb-qt/u1db-qt/trunk/view/head:/src/database.cpp#L143
>
> In Telegram, we'd like to use ~/.config/<app package>/foo.u1db -- from
> QML.
>
> PS Please don't point me to
>
http://stackoverflow.com/questions/16408691/get-home-and-or-username-in-qml
- it's a pain.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/libqtelegram/+bug/1387294/+subscriptions
>

Revision history for this message
Michał Karnicki (karni) wrote :

On Thu, Oct 30, 2014 at 3:09 PM, Giulio Collura <email address hidden>
wrote:

> Since the places allowed by apparmor are limited (I think only
> ~/.config, ~/.local/share and ~/.cache are available, correct me if wrong),
>

​Not on the desktop. At least not yet. I think your u1db-qt patch is good.
and we should simply use ~/.config/com.ubuntu.telegram/settings.u1db​
(temporarily /home/phablet/...)

Not sure if that answers your question.

--
Software Engineer
Professional and Engineering Services
Canonical Ltd.

Ubuntu - Linux for human beings | www.ubuntu.com

Revision history for this message
Cris Dywan (kalikiana) wrote :

This affects ABI and work-arounds stick like super glue. U1Db already has some tricky compatibility issues delaying major bugs in Query. Hard-coding /home/phablet in the app on the other hand is trivial to change later without affecting anything else.

I'm liking the idea of the enum.

It's true that the desktop is not confined yet. I assume that it won't be long, though - if all apps are confined soon it seems moot to add support now in new code. Do we expect trusted helpers in QML that will still run unconfined and for that matter use U1Db?

Revision history for this message
Michał Karnicki (karni) wrote :

Yes, we've temporarily hardcoded /home/phablet.

As to other technicalities, I don't know, I will leave it up to (any active?) U1DB developers to answer.

Revision history for this message
Michał Karnicki (karni) wrote :

I suppose this will not be worked on? We may as well use plain sqlite to store settings, but that's not the point. The point is easing developer annoyances in our offer, really.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Maybe we should just go with the "location: Database.ConfigLocation" proposal at this point. It solves the problem sensibly and, so far as I've seen, there's still no real use case for arbitrary path handling in QML. Other APIs like ContentHub are similarly opaque even when files are being passed around.

Revision history for this message
Michał Karnicki (karni) wrote :

Been a year, I'm giving up on this one. Removing from Telegram bug list.

no longer affects: telegram-app
Michał Karnicki (karni)
Changed in u1db-qt:
status: In Progress → New
assignee: Giulio Collura (gcollura) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.