LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-19-2019, 12:20 PM   #1
TurboBlaze
Member
 
Registered: Jan 2018
Location: Russian Federation, Lipetsk region, Dankov
Distribution: Porteus
Posts: 55

Rep: Reputation: Disabled
How to build cups-bjnp-2.0.1


Hi. I tried to build cups-bjnp-2.0.1 via SBo, like this
Code:
cd /tmp
wget https://slackbuilds.org/slackbuilds/14.2/system/cups-bjnp.tar.gz -P /tmp
tar xf cups-bjnp.tar.gz
cd /tmp/cups-bjnp && curl -O https://netix.dl.sourceforge.net/project/cups-bjnp/cups-bjnp/2.0.1/cups-bjnp-2.0.1.tar.gz
sed -i 's|-1.2|-2.0.1|' /tmp/cups-bjnp/cups-bjnp.SlackBuild
./cups-bjnp.SlackBuild
but I have this error:
Code:
bjnp-commands.c: In function «bjnp_set_command_header»:
bjnp-commands.c:40:5: error: «strncpy» output truncated before terminating nul copying 4 bytes from a string of the same length [-Werror=stringop-truncation]
     strncpy(cmd->header.BJNP_id, BJNP_STRING, sizeof(cmd->header.BJNP_id));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bjnp-commands.c is have code with this line:
Code:
static void
bjnp_set_command_header(uint8_t dev_type, uint16_t seq_no, uint16_t session_id, bjnp_command_t *cmd, char cmd_code,
                        int command_len)
{
    /*
     * Set command buffer with command code, session_id and lenght of payload
     * Returns: sequence number of command
     */
    strncpy(cmd->header.BJNP_id, BJNP_STRING, sizeof(cmd->header.BJNP_id));
    cmd->header.dev_type = dev_type;
    cmd->header.cmd_code = cmd_code;
    cmd->header.unknown1 = htons(0);
    cmd->header.payload_len = htonl(command_len - bjnp_header_size);
    cmd->header.seq_no = htons(seq_no);
    cmd->header.session_id = htons(session_id);
}
How it can be fixed?

Thanks

Last edited by TurboBlaze; 04-20-2019 at 01:42 PM. Reason: solved
 
Old 04-19-2019, 03:32 PM   #2
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,955

Rep: Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648
I tried this on my 14.2 system and I was able to compile it correctly.

Code:
wget https://slackbuilds.org/slackbuilds/14.2/system/cups-bjnp.tar.gz
tar xvf cups-bjnp.tar.gz
sed -i 's|-1.2|-2.0.1|g' cups.*
. cups.info
wget $DOWNLOAD
sh cups-bjnp.SlackBuild
 
Old 04-20-2019, 04:19 AM   #3
TurboBlaze
Member
 
Registered: Jan 2018
Location: Russian Federation, Lipetsk region, Dankov
Distribution: Porteus
Posts: 55

Original Poster
Rep: Reputation: Disabled
bassmadrigal, thanks for your answer.
Probably you are use ./ap/cups-2.1.4-x86_64-1.txz
but I use ./ap/cups-2.2.11-x86_64-1.txz from Slackware64-current.

Regards,
Blaze
 
Old 04-20-2019, 05:16 AM   #4
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,955

Rep: Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648Reputation: 3648
You're correct, I did try it with the stock cups from 14.2. I then grabbed the source from -current for cups and upgraded my cups to that version (I don't have a printed hooked up, so I'm not worried about breakage, and if something unexpected does break, I can reinstall the stock package). I then rebuilt cups-bjnp v2.0.1 and it worked fine.

I'm not sure if you have a full -current install or have just upgraded occasional packages on 14.2 like me...

Otherwise, you can likely bypass this warning-gone-error by adding -Wno-stringop-truncation to the CFLAGS variable in the SlackBuild.
 
Old 04-20-2019, 09:32 AM   #5
glorsplitz
Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 708

Rep: Reputation: 139Reputation: 139
have used bjnp over the years without issue, without using slackbuilds, the following was done using -current all up to date

Code:
wget https://netix.dl.sourceforge.net/project/cups-bjnp/cups-bjnp/2.0.1/cups-bjnp-2.0.1.tar.gz
Code:
tar xvf cups-bjnp-2.0.1.tar.gz
Code:
cd cups-bjnp-2.0.1
based on strncpy calls here should be simple memcpy change strncpy to memcpy
Code:
nano bjnp-commands.c
then
Code:
./configure --with-cupsbackenddir=/usr/lib64/cups/backend
Code:
make
./bjnp was able to find my printer

then
Code:
make install
if works for you

Last edited by glorsplitz; 04-20-2019 at 09:54 AM.
 
1 members found this post helpful.
Old 04-20-2019, 01:41 PM   #6
TurboBlaze
Member
 
Registered: Jan 2018
Location: Russian Federation, Lipetsk region, Dankov
Distribution: Porteus
Posts: 55

Original Poster
Rep: Reputation: Disabled
glorsplitz, I changed strncpy to memcpy and builded tgz package without any troubles.

Guys, thank you so much!

Regards,
Blaze
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linux 4.4 seems to refuse to build IPv6 for the 64-bit build - 32-bit build works fine GameCodingNinja Linux From Scratch 2 02-07-2016 06:40 PM
LXer: Build 'em Right, Build 'em Strong, Build 'em Linux LXer Syndicated Linux News 0 10-01-2007 09:51 PM
Slackware 9 and CUPS (CUPS=crap) - printing carboncopy Slackware 21 07-29-2003 03:27 PM
CUPS in SuSE <> Cups RH' Like? Tiago Cruz Linux - Hardware 0 02-13-2003 12:46 PM
cups-libs need to install cups illtbagu Linux - Newbie 3 01-23-2003 07:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration