You are not logged in.
Pages: 1
Topic closed
Hi there,
I'm trying to add some code to an aur helper that allows autoconfirm pacman request automatically when it come across a packages conflict.
The objective is to obtain a fast workflow operation at the execution, while the package conflict itself is handled way before the package got compiled.
The "yes" command is used to bypass pacman default answer, however the output doesn't look that great:
$ sudo sh -c "yes | pacman-color -U /var/cache/pacman/pkg/cower-3.0.5-1-i686.pkg.tar.xz"
resolving dependencies...
looking for inter-conflicts...
:: cower and cower-git are in conflict. Remove cower-git? [y/N]
Remove (1): cower-git-20110905-1 [0.10 MB]
Total Removed Size: 0.10 MB
Targets (1): cower-3.0.5-1 [0.02 MB]
Total Download Size: 0.00 MB
Total Installed Size: 0.10 MB
Proceed with installation? [Y/n] (1/1) checking package integrity [##################################################] 100%
(1/1) checking for file conflicts [##################################################] 100%
(1/1) removing cower-git [##################################################] 100%
(1/1) installing cower [##################################################] 100%
There is a missing newline after each of the bypassed prompt. I tried with the following without more success:
$ sudo sh -c "yes y$'\n' | pacman <command>"
Not really an important bug, but maybe someone here got an idea how to improve output? Does pacman itself needs to be patched to handle this?
Thanks in advance.
Last edited by Spyhawk (2011-09-05 21:52:25)
Offline
Instead of yes, you can use
--noconfirm do not ask for any confirmation
Offline
--noconfirm is going to answer "No" to the package conflict prompt, which is exactly what I want to avoid
Last edited by Spyhawk (2011-09-05 07:36:05)
Offline
Ah -- good point... I entirely missed that.
Offline
I've noticed that pacman isn't the only app to exhibit this behavior:
[karol@black ~]$ echo "n" | rm test
rm: remove regular file `test'? [karol@black ~]$
[karol@black ~]$ echo "n" | rm test && echo -e "\r"
rm: remove regular file `test'?
[karol@black ~]$
When using 'yes' instead of echo, same problems, same solution / workaround.
Last edited by karol (2011-09-05 13:36:20)
Offline
Thanks karol for your answer,
However, it seems I obtain the very same output as above even when using
sudo sh -c "yes | pacman-color <command> && echo \"\r\""
What I really don't understand is that "yes" command allows a new line to be echoed but it is not taken into account:
$ yes
y
y
y
y
y
y
...
$ yes y$'\n'
y
y
y
y
...
Offline
"Works" here:
[karol@black ~]$ echo "n" | pacman -S qt && echo -e "\r"
resolving dependencies...
looking for inter-conflicts...
Targets (1): qt-4.7.4-1 [24,75 MB]
Total Download Size: 0,00 MB
Total Installed Size: 102,86 MB
Proceed with installation? [Y/n]
[karol@black ~]$
"Works" with 'yes' too:
[karol@black ~]$ yes | pacman -S qt && echo -e "\r"
resolving dependencies...
looking for inter-conflicts...
Targets (1): qt-4.7.4-1 [24,75 MB]
Total Download Size: 0,00 MB
Total Installed Size: 102,86 MB
Proceed with installation? [Y/n] (0/1) checking package integrity [-----
(1/1) checking package integrity [################################] 100%
(1/1) checking for file conflicts [################################] 100%
(1/1) checking available disk space [################################] 100%
(1/1) installing qt [################################] 100%
Optional dependencies for qt
postgresql-libs: PostgreSQL driver
libmysqlclient: MySQL driver
unixodbc: ODBC driver
libxinerama: Xinerama support
libxcursor: Xcursor support
libxfixes: Xfixes support
[karol@black ~]$
but have you noticed
Proceed with installation? [Y/n] (0/1) checking package integrity [-----
- the carriage return gets eaten here.
Could it be related to https://bugs.archlinux.org/task/20538 ?
Last edited by karol (2011-09-05 22:10:37)
Offline
- the carriage return gets eaten here.
Could it be related to https://bugs.archlinux.org/task/20538 ?
Yeah, that might be related to that bug/feature. Any pacman dev to confirm? :]
Offline
Seems unlikely. Comment out the calls to flush_term_input in src/pacman/util.c and see what happens.
Yup. Done that, same problem. That bug isn't related to flush term, but something else :]
Offline
Bug reported by Spyhawk https://bugs.archlinux.org/task/27909
Offline
In case people are confused about why this happens, here's what's going on:
printf("Normal output\n");
printf("A prompt: ");
scanf("%s", str);
The prompt doesn't print \n because you usually type one. That is, you press enter, and that makes a newline.
When you do yes | pacman, the output of yes doesn't get echoed to the screen, so you don't see the \n provided by yes.
One fix is to do something like "if (!isatty(STDIN_FILENO)) printf("\n");" after every prompt. But to me, it's not a bug since most programs work like this.
Offline
https://forum.manjaro.org/t/force-pacma … ges/2272/9
YES_CHAR="$(pacman -Sddw bash --noconfirm | grep '? \[' | cut -d"[" -f2 | cut -d"/" -f1)"
yes "$YES_CHAR" | pacman -S --confirm freetype2-infinality-ultimate fontconfig-infinality-ultimate cairo-infinality-ultimate
Offline
Don't necrobump with commands that don't have relevance to Arch.
https://wiki.archlinux.org/index.php/Co … ort_*only*
https://wiki.archlinux.org/index.php/Co … bumping%22
Closing.
Offline
Pages: 1
Topic closed