Wednesday, January 15, 2014

Ubuntu Adobe Reader 9 Firefox Plugin Annoyance

Launching Firefox web browser on Ubuntu produces these debug files C:\nppdf32Log\debuglog.txt. It is quite annoying especially when developing Firefox Add-ons with Add-on SDK, I have to remove these debug files before committing my sources.

The Adobe Reader 9 plugin is source of this annoying problem. I usually remove the plugin and forget about it. However Robert Fleming provided a better solution.


$ cat C\:\\nppdf32Log\\debuglog.txt 
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called
NPP_GetValue is called

Save this python program and run it with sudo to fix the problem.


#! /usr/bin/python3
# 
# Save and Run as:
# "sudo ./fix_nppdf.py /opt/Adobe/Reader9/Browser/intellinux/nppdf.so"
#

import mmap, sys

target = br'C:\nppdf32Log\debuglog.txt'
replacement = br'/dev/null'
replacement += b'\0' * (len(target) - len(replacement))

with open(sys.argv[1], 'r+') as f:
  m = mmap.mmap(f.fileno(), 0)
  offset = m.find(target)
  assert offset != -1
  m[offset:offset+len(target)] = replacement

No comments:

Post a Comment

You can leave a comment here using your Google account, OpenID or as an anonymous user.

Popular Posts