Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#3614 closed Bug (fixed)

Can't save benc files under uClibc 0.9.31

Reported by: ossy Owned by: charles
Priority: Normal Milestone: 2.11
Component: Transmission Version: 2.10
Severity: Normal Keywords: backport-2.0x
Cc:

Description (last modified by charles)

Hi Transmission-Team,

I cross compiled transmission for my arm device like it is done in several other projects like openwrt,oe,slugos,freetz etc. Unfortunatly I cannot add torrents via the webinterface after I successfully compiled and installed the software on the target. All directories and config files are created, but if I add a torrent via the webinterface I get the following error in the logfile:

...
[22:22:33.372] Searching for web interface file "/usr/share/transmission/web/index.html" (platform.c:526)
[22:22:34.374] Port Forwarding State changed from "Starting" to "???" (port-forwarding.c:95)
[22:22:39.376] Couldn't save file "/var/transmission-statedir/torrents/evbarmcd-5.0.2.iso.9fe3ef5b5a32e862.torrent": Success (bencode.c:1706)
[22:22:51.380] DHT Attempting bootstrap from dht.transmissionbt.com (tr-dht.c:242)
[22:24:26.389] Couldn't save file "/var/transmission-statedir/resume/evbarmcd-5.0.2.iso.9fe3ef5b5a32e862.resume": Success (bencode.c:1706)

I tracked the problem to the code line and found the very common call to write() (bencode.c:1706). If I made a touch outside of transmission the file could be created without problems (with the same user, as transmission runs on).

The port forwarding is not activated now, but I guess the torrent should be saveable anyway. The torrent itself looks good (at least my uTorrent on Windows accepts it).

I'm using uclibc 0.9.31, gcc 4.4.5 optimized for size, linuxthreads and running on armv5te. The problem exists in version 2.04 and 2.10.

Could this be a configuration issue (I do not use any special settings.json, transmission writes the defaults to settings.json) ?

Thanks for any comment or hint how to come over this issue.

Regards, Ossy

Attachments (1)

benc.diff (680 bytes) - added by charles 6 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 follow-up: Changed 6 years ago by charles

  • Description modified (diff)

I can't figure out which version you're using as a point of reference here -- bencode.c:1706 doesn't appear to be linked to write() in either 2.04 or 2.10. Could you elaborate on the write() call that you're referring to, and which version of transmission you're using as a baseline?

The error message you list seems to be coming from 2.10. If so, it looks like unlink() is returning nonzero without setting the value of errno for some reason.

comment:2 in reply to: ↑ 1 ; follow-up: Changed 6 years ago by ossy

Replying to charles:

I can't figure out which version you're using as a point of reference here -- bencode.c:1706 doesn't appear to be linked to write() in either 2.04 or 2.10. Could you elaborate on the write() call that you're referring to, and which version of transmission you're using as a baseline?

Thanks for the quick response. Sorry for the unintended unsharpness. The error message and line number are in fact of version 2.10. I misinterpreted the if-else block in bencode.c. You are right, that unlink() in line 1688 provoques this error and not the write() in line 1683.

The error message you list seems to be coming from 2.10. If so, it looks like unlink() is returning nonzero without setting the value of errno for some reason.

The torrent file I try to add is completely new. Why is it deleted via unlink() ? - Is this a test to be sure that the location is writable? Maybe the close() before unlink() does not sync the data with the real physical medium. So unlink does not find the file after close and returns non-zero... Sorry for the speculation here.

Changed 6 years ago by charles

comment:3 follow-up: Changed 6 years ago by charles

What happens if you apply the patch "benc.diff"?

comment:4 in reply to: ↑ 2 Changed 6 years ago by charles

Replying to ossy:

The torrent file I try to add is completely new. Why is it deleted via unlink() ?

Transmission writes the entire file out to a temporary file in the same directory as its final destination. Once it's written out the file, it unlink()s any previous file with the same name and renames the temporary file to the final filename. This is done so that new .benc files can overwrite older ones, but to prevent data corruption if there's a crash while the file is being written to disk.

comment:5 in reply to: ↑ 3 Changed 6 years ago by ossy

Replying to charles:

What happens if you apply the patch "benc.diff"?

Excellent. That work's - the torrent could be saved:

[..]
[21:25:10.194] Searching for web interface file "/usr/share/transmission/web/index.html" (platform.c:526)
[21:25:48.199] Saved "/data/torrents/evbarmcd-5.0.2.iso.9fe3ef5b5a32e862.torrent" (bencode.c:1697)
[21:25:53.201] evbarmcd-5.0.2.iso Starting DHT announce (poor, 9 nodes) (tr-dht.c:677)
[21:26:05.205] Couldn't connect socket 21 to 68.97.48.147, port 51742 (errno 0 - Success) (net.c:342)
X▒▒r%{<▒▒▒-W▒r▒▒JG▒6▒x6FO▒▒▒[kQ▒▒▒qo▒▒v,zS▒w▒▒nE~▒
▒a▒▒!▒'▒ݑ▒h▒B▒4▒▒-0▒▒q( ▒▒▒ypzpUޑR▒▒]▒▒{▒▒Y▒J\7B▒▒▒A▒D▒▒▒▒-0▒▒▒1w▒▒▒▒▒;ݩ▒▒▒<▒uR▒▒▒▒iA▒▒▒6▒▒-▒▒▒▒O2▒K▒K▒`▒%/▒▒▒▒Y0С▒▒h▒6q▒7^▒--▒▒▒▒8▒ݥ▒▒▒1h▒^▒▒@@b▒▒?▒=▒˛▒olK▒▒▒Y
                                                         z▒\▒

The automatic port forward via UPnP is disabled in my router as default. I haven't set up a port forwarding either. So the socket connect error might be ok - but nevertheless, I get strange characters in the logfile/console (see above). The message says Success with errno 0, but puts unspecified characters on the console...

comment:6 Changed 6 years ago by charles

  • Keywords backport-2.0x added
  • Milestone changed from None Set to 2.11
  • Owner set to charles
  • Status changed from new to assigned

Whoa, no idea where that's coming from. But let's keep the bookkeeping tidy -- this belongs in its own ticket.

comment:7 Changed 6 years ago by charles

  • Status changed from assigned to new
  • Summary changed from Couldn't save file - running with uClibc and gcc 4.4 - torrent not savable to Can't save benc files under uClibc 0.9.31

comment:8 Changed 6 years ago by charles

  • Status changed from new to assigned

Fixed in trunk by r11300

comment:9 Changed 6 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:10 Changed 5 years ago by charles

backported to 2.0x by r11480

Note: See TracTickets for help on using tickets.