* [PATCH 3/3] obex: Use XDG_RUNTIME_DIR as a default root
@ 2013-11-09 17:03 Bastien Nocera
2013-11-10 13:46 ` Bastien Nocera
0 siblings, 1 reply; 5+ messages in thread
From: Bastien Nocera @ 2013-11-09 17:03 UTC (permalink / raw)
To: linux-bluetooth
It's per-user, so we won't try to overwrite somebody else's
files in /tmp when that happens.
---
obexd/src/main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/obexd/src/main.c b/obexd/src/main.c
index 61a06b2..15777f5 100644
--- a/obexd/src/main.c
+++ b/obexd/src/main.c
@@ -50,8 +50,6 @@
#include "obexd.h"
#include "server.h"
-#define DEFAULT_ROOT_PATH "/tmp"
-
#define DEFAULT_CAP_FILE CONFIGDIR "/capability.xml"
static GMainLoop *main_loop = NULL;
@@ -286,7 +284,7 @@ int main(int argc, char *argv[])
}
if (option_root == NULL)
- option_root = g_strdup(DEFAULT_ROOT_PATH);
+ option_root = g_build_filename (g_get_user_runtime_dir (), "obexd", NULL);
if (option_root[0] != '/') {
char *old_root = option_root, *home = getenv("HOME");
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] obex: Use XDG_RUNTIME_DIR as a default root
2013-11-09 17:03 [PATCH 3/3] obex: Use XDG_RUNTIME_DIR as a default root Bastien Nocera
@ 2013-11-10 13:46 ` Bastien Nocera
2013-11-11 9:00 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 5+ messages in thread
From: Bastien Nocera @ 2013-11-10 13:46 UTC (permalink / raw)
To: linux-bluetooth
On Sat, 2013-11-09 at 18:03 +0100, Bastien Nocera wrote:
> It's per-user, so we won't try to overwrite somebody else's
> files in /tmp when that happens.
There might be another useful directory instead. We could use
g_get_user_cache_dir() instead of the run-time dir. This would save
cross-partition moves by default, making the move to the Downloads dir
atomic (a single rename, which can fail, iterate until we find a "free"
filename).
Is that better for you?
> ---
> obexd/src/main.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/obexd/src/main.c b/obexd/src/main.c
> index 61a06b2..15777f5 100644
> --- a/obexd/src/main.c
> +++ b/obexd/src/main.c
> @@ -50,8 +50,6 @@
> #include "obexd.h"
> #include "server.h"
>
> -#define DEFAULT_ROOT_PATH "/tmp"
> -
> #define DEFAULT_CAP_FILE CONFIGDIR "/capability.xml"
>
> static GMainLoop *main_loop = NULL;
> @@ -286,7 +284,7 @@ int main(int argc, char *argv[])
> }
>
> if (option_root == NULL)
> - option_root = g_strdup(DEFAULT_ROOT_PATH);
> + option_root = g_build_filename (g_get_user_runtime_dir (), "obexd", NULL);
>
> if (option_root[0] != '/') {
> char *old_root = option_root, *home = getenv("HOME");
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] obex: Use XDG_RUNTIME_DIR as a default root
2013-11-10 13:46 ` Bastien Nocera
@ 2013-11-11 9:00 ` Luiz Augusto von Dentz
2013-11-11 12:35 ` Bastien Nocera
0 siblings, 1 reply; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2013-11-11 9:00 UTC (permalink / raw)
To: Bastien Nocera; +Cc: linux-bluetooth@vger.kernel.org
Hi Bastien,
On Sun, Nov 10, 2013 at 3:46 PM, Bastien Nocera <hadess@hadess.net> wrote:
> On Sat, 2013-11-09 at 18:03 +0100, Bastien Nocera wrote:
>> It's per-user, so we won't try to overwrite somebody else's
>> files in /tmp when that happens.
>
> There might be another useful directory instead. We could use
> g_get_user_cache_dir() instead of the run-time dir. This would save
> cross-partition moves by default, making the move to the Downloads dir
> atomic (a single rename, which can fail, iterate until we find a "free"
> filename).
>
> Is that better for you?
Yep, it sounds better. Regarding renaming that is up the agent, if you
really want to do that its probably fine but Im still not convinced
this is absolutely necessary if obexd is running with the same user as
the agent can just create the file while authorizing so you wouldn't
need to move after completed, but again this is completely up to the
agent to decide where the files should go.
Btw, what about fd passing? In theory we can create a different
version of the agent interface to enable passing fd directly, and in
fact we were thinking about this already as for some services you
wanted them to be dynamic so we were thinking on having this set by
the agent when it registers.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] obex: Use XDG_RUNTIME_DIR as a default root
2013-11-11 9:00 ` Luiz Augusto von Dentz
@ 2013-11-11 12:35 ` Bastien Nocera
2013-11-11 13:01 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 5+ messages in thread
From: Bastien Nocera @ 2013-11-11 12:35 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org
On Mon, 2013-11-11 at 11:00 +0200, Luiz Augusto von Dentz wrote:
> Hi Bastien,
>
> On Sun, Nov 10, 2013 at 3:46 PM, Bastien Nocera <hadess@hadess.net> wrote:
> > On Sat, 2013-11-09 at 18:03 +0100, Bastien Nocera wrote:
> >> It's per-user, so we won't try to overwrite somebody else's
> >> files in /tmp when that happens.
> >
> > There might be another useful directory instead. We could use
> > g_get_user_cache_dir() instead of the run-time dir. This would save
> > cross-partition moves by default, making the move to the Downloads dir
> > atomic (a single rename, which can fail, iterate until we find a "free"
> > filename).
> >
> > Is that better for you?
>
> Yep, it sounds better. Regarding renaming that is up the agent, if you
> really want to do that its probably fine but Im still not convinced
> this is absolutely necessary if obexd is running with the same user as
> the agent can just create the file while authorizing so you wouldn't
> need to move after completed, but again this is completely up to the
> agent to decide where the files should go.
You seem to think that all the application/services running under one
user would have the same rights. That's currently the case, but won't be
in the future.
> Btw, what about fd passing? In theory we can create a different
> version of the agent interface to enable passing fd directly, and in
> fact we were thinking about this already as for some services you
> wanted them to be dynamic so we were thinking on having this set by
> the agent when it registers.
I'm fine with a file descriptor as well, but obex push server is
currently broken in GNOME 3.10. I'm happy doing the changes in GNOME
3.12 (due in 6 months).
Can we get the cache dir change in, and make the API change later on?
Cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] obex: Use XDG_RUNTIME_DIR as a default root
2013-11-11 12:35 ` Bastien Nocera
@ 2013-11-11 13:01 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2013-11-11 13:01 UTC (permalink / raw)
To: Bastien Nocera; +Cc: linux-bluetooth@vger.kernel.org
Hi Bastien,
On Mon, Nov 11, 2013 at 2:35 PM, Bastien Nocera <hadess@hadess.net> wrote:
> On Mon, 2013-11-11 at 11:00 +0200, Luiz Augusto von Dentz wrote:
>> Hi Bastien,
>>
>> On Sun, Nov 10, 2013 at 3:46 PM, Bastien Nocera <hadess@hadess.net> wrote:
>> > On Sat, 2013-11-09 at 18:03 +0100, Bastien Nocera wrote:
>> >> It's per-user, so we won't try to overwrite somebody else's
>> >> files in /tmp when that happens.
>> >
>> > There might be another useful directory instead. We could use
>> > g_get_user_cache_dir() instead of the run-time dir. This would save
>> > cross-partition moves by default, making the move to the Downloads dir
>> > atomic (a single rename, which can fail, iterate until we find a "free"
>> > filename).
>> >
>> > Is that better for you?
>>
>> Yep, it sounds better. Regarding renaming that is up the agent, if you
>> really want to do that its probably fine but Im still not convinced
>> this is absolutely necessary if obexd is running with the same user as
>> the agent can just create the file while authorizing so you wouldn't
>> need to move after completed, but again this is completely up to the
>> agent to decide where the files should go.
>
> You seem to think that all the application/services running under one
> user would have the same rights. That's currently the case, but won't be
> in the future.
Interesting that would cause some problems for sure...
>> Btw, what about fd passing? In theory we can create a different
>> version of the agent interface to enable passing fd directly, and in
>> fact we were thinking about this already as for some services you
>> wanted them to be dynamic so we were thinking on having this set by
>> the agent when it registers.
>
> I'm fine with a file descriptor as well, but obex push server is
> currently broken in GNOME 3.10. I'm happy doing the changes in GNOME
> 3.12 (due in 6 months).
>
> Can we get the cache dir change in, and make the API change later on?
Yep, lets use the cache dir and then think about the API change.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-11 13:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-09 17:03 [PATCH 3/3] obex: Use XDG_RUNTIME_DIR as a default root Bastien Nocera
2013-11-10 13:46 ` Bastien Nocera
2013-11-11 9:00 ` Luiz Augusto von Dentz
2013-11-11 12:35 ` Bastien Nocera
2013-11-11 13:01 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox