Pacman

Historical bug tracker for the Pacman package manager.

The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues

This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
Tasklist

FS#11452 - pacman should log how it was invoked

Attached to Project: Pacman
Opened by Carlo Bersani (carlocci) - Friday, 12 September 2008, 00:08 GMT
Last edited by Xavier (shining) - Monday, 07 September 2009, 10:53 GMT
Task Type Feature Request
Category General
Status Closed
Assigned To Xavier (shining)
Architecture All
Severity Low
Priority Normal
Reported Version 3.2.1
Due in Version 3.4.0
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Summary and Info:
Pacman should log the command line through which it has been invoked.
For example, instead of "starting full system upgrade", it should report "pacman -Su".
This would really help logging because you would be able to recognize installation sessions, what command the user used in order to destroy his system, as well as which packages were installed as dependencies and which weren't.
In this way it would be possible to restore a local database completely from a pacman.log, provided you knew what packages were installed from the install cd, or if the pacman.log from the install cd is copied to system at install time (lots of installing in this sentence).

Thanks for reading.
This task depends upon

Closed by  Xavier (shining)
Monday, 07 September 2009, 10:53 GMT
Reason for closing:  Implemented
Additional comments about closing:  in git commit c88ac86292
Comment by Dieter Plaetinck (Dieter_be) - Sunday, 05 October 2008, 08:27 GMT
I like this idea. All package frontends should log how they are invoked (pacman -Sy <foo>, yaourt -R <bar>).
But it wouldn't be perfectly reliable though: behavior of frontends can change, switches can change meaning over the years.
Also if you would replay the log you could do lots of useless actions if the user installed packages and removed them again, especially if packages changed names, got integrated/split-up, .. etc.
So I wouldn't use it as 'backup-restore' system, but I think it would be very useful to do debugging/request help/find out why you broke your system etc.

Comment by eS.eF. (Dimorph) - Saturday, 20 December 2008, 11:32 GMT
In this manner?
Comment by Dieter Plaetinck (Dieter_be) - Saturday, 20 December 2008, 11:41 GMT
Yep, that seems to be exactly what I had in mind.
Comment by Allan McRae (Allan) - Sunday, 21 December 2008, 02:30 GMT
You need to free cl_text_new.
Comment by eS.eF. (Dimorph) - Sunday, 21 December 2008, 12:00 GMT
No!
Because I point cl_text to the location of cl_text_new and free later the cl_text

[...]
+ cl_text_new = calloc(1, cl_text_size+cl_argv_size+1);
+ memcpy(cl_text_new, cl_text, cl_text_size);
+ free(cl_text);
+ cl_text = cl_text_new;
[...]
+ free(cl_text);
[...]

ok?
Comment by Allan McRae (Allan) - Sunday, 21 December 2008, 12:17 GMT
Good point... Not sure how I missed that! (C++ strings are my friend)

Now one more query...

+ cl_text_new = calloc(1, cl_text_size+cl_argv_size+1);
[...]
+ // prevent ugly last space
+ if(cl_counter+1 < argc)
+ strncat(cl_text, " ", 1);

so on the last argument cl_text is left with an empty character slot at the end. Does this get "initialised" with garbage in C and thus might cause strange output?

Would it be better to initialise cl_text with the first arguement and then loop from 1 to cl_counter<argc, adding the space at before the argument in the loop? That would also save testing if this is the last term at each step.
Comment by eS.eF. (Dimorph) - Sunday, 21 December 2008, 13:00 GMT
No, cl_text gets initialized with \0 throught calloc.

Excerpt from "man 3 calloc":
calloc() allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. [...]
Comment by Xavier (shining) - Thursday, 06 August 2009, 10:19 GMT
there were a few bugs so I decided to rewrite the cl_to_log function

Loading...