/data/local/tmp not being cleared on reboots



Firefox OS
6 years ago
5 years ago


(Reporter: cjones, Assigned: gsvelto)


Gonk (Firefox OS)
Dependency tree / graph
Bug Flags:
in-moztrap -

Firefox Tracking Flags

(blocking-b2g:tef+, b2g18 verified, b2g18-v1.0.0 fixed, b2g18-v1.0.1 verified)



(2 attachments)

In normal operation, gecko should never leave long-lived files in $TMPDIR, but it can happen in a few cases
 - bugs
 - users playing with off-by-default features like the profiler

We should rm -r /data/local/tmp on bootup as a poor man's approximation to a tmpfs.

I think we should get this in for v1.0.0.
Presumably, this should go in b2g.sh just before it creates /data/local/tmp
Created attachment 707369 [details] [diff] [review]
Remove /data/local/tmp and contents whenever b2g restarts

Hmmm. This will remove /data/local/tmp each time b2g.sh is run, rather than each time the phone boots.

r- if you really intended this to be each time the phone boots (in which case it needs to go into init-b2g.rc)
Attachment #707369 - Flags: review?(jones.chris.g)
Comment on attachment 707369 [details] [diff] [review]
Remove /data/local/tmp and contents whenever b2g restarts

Yeah, this will mess with shell users and other daemons that might doing innocuous things with TMP.  Provisional r- unless there's not really a better way.
Attachment #707369 - Flags: review?(jones.chris.g) → review-
Another way we could leave it in b2g.sh but make it happen only the first time that b2g.sh is run per boot of the phone would be to put a marker in one of the real tmpfs filesystems, like /dev

Something like:

if [ ! -f /dev/.tmp.removed ]; then
  rm -rf $TMPDIR
  touch /dev/.tmp.removed
That should work.  It'd be a lot cleaner to stick this in an init.rc as an |on boot| trigger (or one of the earlier ones), but I have no idea how init.rc's are assembled downstream.
Why not just shove this in init.b2g.rc?

on init
  rm -r /data/local/tmp # $TMPDIR doesn't exist yet.
That'd be ideal but I assumed you guys weren't picking that up.
We use a stock init.b2g.rc from gonk-misc/
Assignee: nobody → dhylands
blocking-b2g: tef? → tef+
Marking status-b2g18 and status-b2g18-v1.0.0 as affected, please update the status to fixed once this is verified landed on v1-train/mozilla-b2g18 and v1.0.0/mozilla-b2g18_v_1_0_0
status-b2g18: --- → affected
status-b2g18-v1.0.0: --- → affected
I'm going to transfer this to mwu, since I don't have anything setup to create a kernel/initramfs, and therefore can't test this easily.
Assignee: dhylands → mwu
Michael, any progress on this?  Have you had a chance to look at it at all?
Flags: needinfo?(mwu)
What are the next steps here?  The deadline for landing blocker bugs is rapidly approaching (2/15) and getting this landed sooner rather than later to shake out any possible regressions would be ideal.

Comment 13

5 years ago
I had some spare cycles and I've tried the fix from comment 6 on my Otoro but it doesn't work. This works fine however:

on boot
    exec /system/bin/rm -r /data/local/tmp

I'll make a pull request against gonk-misc with this change which - if I understand comment 8 correctly - should be enough.
Flags: needinfo?(mwu)

Comment 14

5 years ago
Created attachment 712461 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gonk-misc/pull/72

Pointer to Github pull-request


5 years ago
Attachment #712461 - Flags: review?(jones.chris.g)

Comment 15

5 years ago
Comment on attachment 712461 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gonk-misc/pull/72

Tested and works, thanks!
Attachment #712461 - Flags: review?(jones.chris.g) → review+


5 years ago
Assignee: mwu → gsvelto


5 years ago
Last Resolved: 5 years ago
Resolution: --- → FIXED


5 years ago
OS: Linux → Gonk (Firefox OS)
Hardware: x86_64 → All

Comment 16

5 years ago
Cherry picked and placed on v1-train and v1.0.0
status-b2g18: affected → fixed
status-b2g18-v1.0.0: affected → fixed
status-b2g18-v1.0.1: --- → fixed
This isn't fixed in the b2g-manifeset repository, which means that the fix isn't deployed.  I also see that the v1.0.1 branch flag was set to 'fixed', which isn't valid because we don't have a v1.0.1 branch in gonk-misc, so this commit doesn't live anywhere.

mwu's cherry-pick commits are:

v1-train: ded7bc971be7f0543db3e7dcf8e2ff134739aef2
v1.0.0: 653d167e33c5be0176945427b958f4a9f773bc4f

I've filed a bug for releng to create the branches we need to land the fix to (bug 844960).
status-b2g18: fixed → affected
status-b2g18-v1.0.0: fixed → affected
status-b2g18-v1.0.1: fixed → affected
Fixed on v1-train and v1.0.0 branches.  Still waiting on the branches to be created, but we should be able to point the v1.0.1 gonk-misc commit to the one that's on v1-train as v1-train should be the branch point for creating v1.0.1 on the gonk-misc repo

b2g-manifest v1-train: f85d0ec1a36aa3980635fc1108bb2f450dafafd8
b2g-manifest v1.0.0: 8bfaf63dfc15efa3736566a28f52933e0c7581c3
status-b2g18: affected → fixed
status-b2g18-v1.0.0: affected → fixed
b2g-manifest v1.0.1: c139b1e4acd064cedaa8c6059d953a9a7d505214
status-b2g18-v1.0.1: affected → fixed

Comment 20

5 years ago
Does not make sense to create a regression issue.
Flags: in-moztrap-
Can you please provide steps to verify this fix - as we will blackbox test from the UI?
adb shell 'date > /data/local/tmp/date.txt'
adb reboot

After phone boots up, verify /data/local/tmp/date.txt doesn't exist.


adb shell ls -l /data/local/tmp/date.txt

should return

/data/local/tmp/date.txt: No such file or directory
Unagi Build ID: 20130313070202
Gecko: http://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/e74dafa6b2d9
Gaia: b34e726147f8e671ad8c538b50900ccfbffcb084
Kernel: Dec 5th

Verified that the process in Comment 22 works as described on both V1.0.1 and V1.
status-b2g18: fixed → verified
status-b2g18-v1.0.1: fixed → verified


5 years ago


5 years ago
Blocks: 884985
You need to log in before you can comment on or make changes to this bug.