Ubuntu patches

11 views
Skip to first unread message

axelgenus

unread,
Aug 7, 2010, 1:00:09 PM8/7/10
to btpd general discussion
I just noticed today that Ubuntu provides a modified version of btpd.
It uses a global path for storing information (/var/lib/btpd). It's
quite useful when you work in multiuser environment but it also breaks
the compatibility with other interfaces.

Bye,
Alessandro.

Cesare Falco

unread,
Aug 7, 2010, 5:19:10 PM8/7/10
to btpd-...@googlegroups.com
> I just noticed today that Ubuntu provides a modified version of btpd.
> It uses a global path for storing information (/var/lib/btpd). It's
I wanted btpd to act as a system daemon on my box, much like mldonkey
and fetchmail. Once proposed for approval, it turned out to be good
for others too, and my package got accepted.

> quite useful when you work in multiuser environment but it also breaks
> the compatibility with other interfaces.

Alas, it's true. There's also a bug filed on Launchpad:
https://bugs.edge.launchpad.net/ubuntu/+source/btpd/+bug/275326

which I've been pondering to forward to github.

My 2(euro)cents thoughts, we could either:

a) check which user started the daemon on kill request and refuse to
obey in case it doesn't match

b) provide something like a new switch to tell btpd to run in
system mode

Waiting for further suggestions... ;)

Cesare.


Alessandro Calorì

unread,
Aug 8, 2010, 3:26:14 AM8/8/10
to btpd-...@googlegroups.com
Well, the problem is not the daemon (I can chmod the daemon's socket
and still connecting to it) but the creation of files when you
download something: btpd can't write on users' directories and it dies
(I guess for a segfault but I still have to check).

btpd was designed to work in a user-specific environment and honestly
I don't see a simple way to do otherwise.

Bye,
Alessandro.

2010/8/7 Cesare Falco <cesare...@gmail.com>:

Cesare Falco

unread,
Aug 9, 2010, 4:11:16 AM8/9/10
to btpd-...@googlegroups.com
> download something: btpd can't write on users' directories and it dies
that's probably a permission issue, the "common" torrent files
directory is owned by the btpd user and is not world-wide writable.

I agree hard-coding the directory name is a *bad* idea, however it's
just a quick hack and it could be managed with a switch.

> btpd was designed to work in a user-specific environment and honestly

I guess you're referring to an environment in which only a single user
can start btpd, but Ubuntu is a multi-user environment in which
multiple users are supposed to use btpd.

Starting a different instance for each user would simply be a waste of
resources (ports and memory). The disadvantage of a single daemon is
that users must share what they download, but we're not speaking of
illegal material, are we? ;)

> I don't see a simple way to do otherwise.

btpd works good with the current configuration in Ubuntu, it only has
two issues:
1) "btcli kill" still stops the daemon in an unclean way, as does sudo
/etc/init.d/btpd stop
2) torrent files are put in subdirectories of /var/lib/btpd/files,
(hardcoded with a patch) which is owned by the "btpd" user and has no
world-wide write permission

To solve 1), btpd should be aware of what "mode" is running in, user
or system, and refuse to shutdown in the latter case.

To solve 2), a switch stating the base directory for the torrent
directory should suffice.

Cheers,
Cesare.

Alessandro Calorì

unread,
Aug 9, 2010, 4:34:32 AM8/9/10
to btpd-...@googlegroups.com
Cesare, I was talking about the code: there's not an easy way to
overcome the limits of btpd architecture. However starting a daemon
for each user is not such a great waste of resources because btpd is
very small (it was designer for this purpose).

Theoretically speaking the best way to solve this problem is to split
the daemon in two parts: a common part which implements the core logic
of the application and another part that manages the I/O. We could ask
btpd to fork a new process with the right permission to handle the
user's I/O requests. This way we would have one shared process running
most of the code and many child processes (one per user) to handle the
I/O. I repeat: it's not simple and it would require a complete rewrite
of the program.

Bye,
Alessandro.

2010/8/9 Cesare Falco <cesare...@gmail.com>:

Janne Johansson

unread,
Aug 10, 2010, 7:17:25 AM8/10/10
to btpd-...@googlegroups.com


2010/8/9 Alessandro Calorì <axel...@gmail.com>

Cesare, I was talking about the code: there's not an easy way to
overcome the limits of btpd architecture. However starting a daemon
for each user is not such a great waste of resources because btpd is
very small (it was designer for this purpose).


Think of it as if Ubuntu was to change Firefox to have one single DL directory for all users
and put that under /var somewhere.
-"We can have lots of FF download dirs for each user, that would be a waste"... 

--
 To our sweethearts and wives.  May they never meet. -- 19th century toast

Cesare Falco

unread,
Aug 10, 2010, 9:01:01 AM8/10/10
to btpd-...@googlegroups.com
I see your point, but I've never meant btpd to act as a fully featured
multi-user daemon.
I agree, this would imply rewriting it nearly from scratch.

What I was looking for was a way to make btpd act as a standalone,
unattended server, mainly for seeding rather than leeching files.

However, if you think this may confusing for users or harmul for
btpd's (deserved) good reputation, I can modify the package or even
ask for removal from official repos.

Cheers,
Cesare.


2010/8/10, Janne Johansson <icep...@gmail.com>:

Alessandro Calorì

unread,
Aug 10, 2010, 9:20:19 AM8/10/10
to btpd-...@googlegroups.com
The idea is fine but I see that btpd doesn't act correctly in that
environment: it dies when it tries to write where it doesn't have
permission to do it. btpd should handle this better by stopping the
torrent and log the event (the latter is already working).

Right now I'm working on gbtpd but I'll write a patch if no one is
willing to take care of this one.

Bye,
Alessandro.

2010/8/10 Cesare Falco <cesare...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages