Bug 1699699

Summary: Pkg: unixcw Program: cw - Does not generate morse code from stdin or from a text file
Product: [Fedora] Fedora Reporter: Alvin Austin <alvin>
Component: unixcwAssignee: Richard Shaw <hobbes1069>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 31CC: bobjensen, hobbes1069, lucilanga
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: unixcw-3.5.1-3.fc30 unixcw-3.5.1-3.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-21 00:55:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alvin Austin 2019-04-15 02:39:37 UTC
Description of problem:
- The cw program within the unixcw does not generate morse code from stdin or from a file. It does work from the keyboard.

Version-Release number of selected component (if applicable):
- unixcw-3.5.1-1.fc30.x86_64

How reproducible:
Always. Also fails in Fedora 29. 


Steps to Reproduce:

A. Entering characters from the keyboard WORKS.
1. # dnf install unixcw
2. $ cw
3. Type: hello (ENTER)
4. You hear the generated morse code with the default settings. Press Ctrl-C or Ctrl-D to exit.

B. Piping into cw FAILS.
1. $ echo hello | cw
2. The word "hello" is echoed to the console, but you only hear a single beep.

C. Generating morse code from a text file also FAILS.
1. $ echo hello > data.txt
2. $ cw -f data.txt
3. The word "hello" is echoed to the console, but you only hear a single beep. (Same result as in test B above).
4. $ cw --infile=data.txt
5. The word "hello" is echoed to the console, but you only hear a single beep. (Same result as in test B above).


Actual results:
liveuser@localhost-live ~]$ echo hello | cw
cw: PulseAudio output not available (device: ( default ))
cw: OSS output not available (device: /dev/audio)
hello    --> hello in morse code is not heard. Single beep only.
[liveuser@localhost-live ~]$ 


Expected results:
You should hear the generated morse code, just as you do if you type in the text directly from the keyboard (test A above).


Additional info:
Works in Ubuntu 18.04.

Comment 1 Alvin Austin 2019-04-15 05:24:42 UTC
Testing on Fedora 29 - Recompiling unixcw from source after installing pulseaudio-libs-devel-12.2-1.fc29.x86_64 package seems to have resolved the problem.

$ rpmbuild --rebuild ~/unixcw-3.5.1-1.fc30.src.rpm 
[..]
configure: ----------------------------------------------
configure: ------ unixcw 3.5.1 build configuration ------
configure: operating system:  ......................  linux-gnu
configure: build libcw:  ...........................  yes
configure:     libcw soname version:  ..............  "6:6:1"
configure:     include console buzzer support:  ....  yes
configure:     include OSS support:  ...............  yes
configure:     include ALSA support:  ..............  yes
configure:     include PulseAudio support:  ........  yes
configure: build cw:  ..............................  yes
configure: build cwgen:  ...........................  yes
configure: build cwcp:  ............................  yes
configure: build xcwcp:  ...........................  no
configure: ----------------------------------------------
[..]

This package should be recompiled for Fedora 30 also.  Thanks!

Comment 2 Richard Shaw 2019-04-15 13:05:58 UTC
Hopefully a simple rebuild fixes the problem but it doesn't make any sense... Looking at the build logs for the f29 build, pulseaudio support is enabled and checking root.log, pulseaudio-libs-devel is installed and it's the same version/release you reference.

Comment 3 Alvin Austin 2019-05-02 17:32:23 UTC
WORKAROUND:

After further testing with the F30 live distribution, I've found that the "cw" program is somehow dependent on the pulseaudio-libs-devel package being installed on the *run-time* host (not just the host that the unixcw RPM was built on).

Demonstration:

1. Boot the F30 live distribution, open a terminal, "su -" to become root.
2. Install unixcw
   # dnf install -y unixcw
3. Open a normal non-root window to test. FAILS.
   $ echo hi | cw
4. From the root terminal, install the pre-requisite RPMs for pulseaudio-libs-devel
   # dnf install -y glib2-devel libblkid-devel libffi-devel libmount-devel libselinux-devel libsepol-devel libuuid-devel pcre2 pcre2-devel pcre2-utf16 pcre2-utf32 pcre pcre-cpp pcre-devel pcre-utf16 pcre-utf32 zlib-devel
5. Retest in the non-root window to test. STILL FAILS.
   $ echo hi | cw
6. Now install pulseaudio-libs-devel in the root terminal. No other dependent RPMs are needed:

[root@localhost ~]# dnf install pulseaudio-libs-devel
Last metadata expiration check: 0:09:47 ago on Thu 02 May 2019 12:55:13 PM EDT.
Dependencies resolved.
================================================================================
 Package                     Architecture Version            Repository    Size
================================================================================
Installing:
 pulseaudio-libs-devel       x86_64       12.2-3.fc30        fedora       443 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 443 k
Installed size: 4.5 M
Is this ok [y/N]: y
Downloading Packages:
pulseaudio-libs-devel-12.2-3.fc30.x86_64.rpm    684 kB/s | 443 kB     00:00    
--------------------------------------------------------------------------------
Total                                           384 kB/s | 443 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : pulseaudio-libs-devel-12.2-3.fc30.x86_64               1/1 
  Running scriptlet: pulseaudio-libs-devel-12.2-3.fc30.x86_64               1/1 
  Verifying        : pulseaudio-libs-devel-12.2-3.fc30.x86_64               1/1 

Installed:
  pulseaudio-libs-devel-12.2-3.fc30.x86_64                                      

Complete!

7. Retest in the non-root window to test. WORKS!!
   $ echo hi | cw

It seems odd that the cw runtime binary is dependent on the pulseaudio-libs-devel rpm being installed ...

Comment 4 Alvin Austin 2019-11-03 05:29:05 UTC
Was working on Fedora 30 as described above with the pulseaudio-libs-devel rpm installed.

After a Fedora 30->31 upgrade ( https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/ ), the "cw" program now does not generate *any* sound on Fedora 31. BROKEN.

# rpm -qi unixcw
Name        : unixcw
Version     : 3.5.1
Release     : 2.fc31
Architecture: x86_64
[..]

$ echo hello |cw
cw: PulseAudio output not available (device: ( default ))
cw: OSS output not available (device: /dev/audio)
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

cw: ALSA output not available (device: default)
hello
$

Comment 5 Richard Shaw 2019-11-12 02:14:42 UTC
Ok, I figured out part of the problem. The method used to dlopen pulse is wrong, it depends explicitly on libpulse-simple.so (not the SOVERSION named library) which is only provided by the devel package. Working on it but I'm not much of a C/C++ guy.

Comment 6 Fedora Update System 2019-11-12 03:16:00 UTC
FEDORA-2019-f18ad78406 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-f18ad78406

Comment 7 Fedora Update System 2019-11-13 10:46:22 UTC
unixcw-3.5.1-3.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-fe8edd2fc4

Comment 8 Fedora Update System 2019-11-13 10:52:16 UTC
unixcw-3.5.1-3.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f18ad78406

Comment 9 Alvin Austin 2019-11-13 22:29:23 UTC
# cat /etc/redhat-release
Fedora release 31 (Thirty One)

# rpm -q unixcw
unixcw-3.5.1-3.fc31.x86_64

$ echo hello|cw
cw: PulseAudio output not available (device: ( default ))
cw: OSS output not available (device: /dev/audio)
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

cw: ALSA output not available (device: default)
hello

RESULT: FAILED - the characters appear on the screen but no sound.

Comment 10 Richard Shaw 2019-11-13 22:31:29 UTC
Interesting, I'm still on F30 and it will play one letter for me then stop.

Comment 11 Richard Shaw 2019-11-16 13:47:17 UTC
The version from testing works for me on my freshly upgraded Fedora 31 box.

Comment 12 Fedora Update System 2019-11-21 00:55:09 UTC
unixcw-3.5.1-3.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2019-11-21 01:24:26 UTC
unixcw-3.5.1-3.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.