Server : Apache/2.4.41 (Ubuntu) System : Linux journalup 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/doc/apport/ |
Apport symptom scripts ====================== In some cases it is quite hard for a bug reporter to figure out which package to file a bug against, especially for functionality which spans multiple packages. For example, sound problems are divided between the kernel, alsa, pulseaudio, and gstreamer. Apport supports an extension of the notion of package hooks to do an interactive "symptom based" bug reporting. Calling the UI with just "-f" and not specifying any package name shows the available symptoms, the user selects the matching category, and the symptom scripts can do some question & answer game to finally figure out which package to file it against and which information to collect. Alternatively, the UIs can be invoked with "-s symptom-name". Structure ========= Symptom scripts go into /usr/share/apport/symptoms/symptomname.py, and have the following structure: ------------ 8< ---------------- description = 'One-line description' def run(report, ui): problem = ui.choice('What particular problem do you observe?', ['Thing 1', 'Thing 2', ... ]) # collect debugging information here, ask further questions, and figure out # package name return 'packagename' ------------ 8< ---------------- They need to define a run() method which can use the passed HookUI object for interactive questions (see package-hooks.txt for details about this). run() can optionally add information to the passed report object, such as tags. Before run() is called, Apport already added the OS and user information to the report object. After the symptom run() method, Apport adds package related information and calls the package hooks as usual. run() has to return the (binary) package name to file the bug against. Just as package hooks, if the user canceled an interactive question for which the script requires an answer, run() should raise StopIteration, which will stop the bug reporting process. Example ======= import apport description = 'External or internal storage devices (e. g. USB sticks)' def run(report, ui): problem = ui.choice('What particular problem do you observe?', ['Removable storage device is not mounted automatically', 'Internal hard disk partition cannot be mounted manually', # ... ] # collect debugging information here, ask further questions if not kernel_detected: return apport.packaging.get_kernel_package() if not udev_detected: return 'udev' return 'devicekit-disks'