linux cat命令增加文件名功能后修复可能出现的bug

增加显示文件名功能后,需要将输出缓冲区的大小增加FILENAME_MAX+1,FILENAME_MAX为当前系统文件名最长时占用的字节数,1为冒号占用的1字节,否则在特殊情况下,会导致输出缓冲区不够用,程序崩溃报段错误。

仅仅修改cat.c, 对比cat.c差异。

bibo@sunny:~/work/coreutils/coreutils$ git diff 64efc26d39266b72af029e8acf537f1f28a92c0a 6db2e33883c4bae7b2c375e5b5bad0605267a34e
diff --git a/src/cat.c b/src/cat.c
index 178c61c02..7409ac879 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -799,7 +799,8 @@ main (int argc, char **argv)idx_t bufsize;if (ckd_mul (&bufsize, insize, 4)|| ckd_add (&bufsize, bufsize, outsize)
-              || ckd_add (&bufsize, bufsize, LINE_COUNTER_BUF_LEN - 1))
+              || ckd_add (&bufsize, bufsize, LINE_COUNTER_BUF_LEN - 1)
+              || ckd_add (&bufsize, bufsize, FILENAME_MAX + 1))xalloc_die ();char *outbuf = xalignalloc (page_size, bufsize);

insize为输入缓冲区每次从输入最大读取的字节数。

insize * 4表示输入缓冲区的每个字节最大会增加为4倍并放入输出缓冲区,处理特殊字符时会出现。

outsize为输出缓冲区阈值,当输出缓冲区当前含有字节数大于等于outsize时,就会向文件循环写入outsize字节,直到输出缓冲区阈值低于outsize。所以输出缓冲区最大可能残留outsize-1字节数据。

LINE_COUNTER_BUF_LEN - 1为输出行号最大需要的字节数。

所以输出缓冲区最大可能为insize*4 + outsize - 1 + LINE_COUNTER_BUF_LEN - 1 + FILENAME_MAX+1

输出缓冲区分配的大小再加1更安全,所以实际分配的大小为insize*4 + outsize - 1 + LINE_COUNTER_BUF_LEN - 1 + FILENAME_MAX+1+1。

修改后的cat.c文件

/* cat -- concatenate files and print on the standard output.Copyright (C) 1988-2023 Free Software Foundation, Inc.This program is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program.  If not, see <https://www.gnu.org/licenses/>.  *//* Differences from the Unix cat:* Always unbuffered, -u is ignored.* Usually much faster than other versions of cat, the differenceis especially apparent when using the -v option.By tege@sics.se, Torbjörn Granlund, advised by rms, Richard Stallman.  */#include <config.h>#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>#if HAVE_STROPTS_H
# include <stropts.h>
#endif
#include <sys/ioctl.h>#include "system.h"
#include "alignalloc.h"
#include "ioblksize.h"
#include "fadvise.h"
#include "full-write.h"
#include "safe-read.h"
#include "xbinary-io.h"/* The official name of this program (e.g., no 'g' prefix).  */
#define PROGRAM_NAME "cat"#define AUTHORS \proper_name_lite ("Torbjorn Granlund", "Torbj\303\266rn Granlund"), \proper_name ("Richard M. Stallman")/* Name of input file.  May be "-".  */
static char const *infile;/* Descriptor on which input file is open.  */
static int input_desc;/* Buffer for line numbers.An 11 digit counter may overflow within an hour on a P2/466,an 18 digit counter needs about 1000y */
#define LINE_COUNTER_BUF_LEN 20
static char line_buf[LINE_COUNTER_BUF_LEN] ={' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0','\t', '\0'};/* Position in 'line_buf' where printing starts.  This will not changeunless the number of lines is larger than 999999.  */
static char *line_num_print = line_buf + LINE_COUNTER_BUF_LEN - 8;/* Position of the first digit in 'line_buf'.  */
static char *line_num_start = line_buf + LINE_COUNTER_BUF_LEN - 3;/* Position of the last digit in 'line_buf'.  */
static char *line_num_end = line_buf + LINE_COUNTER_BUF_LEN - 3;/* Preserves the 'cat' function's local 'newlines' between invocations.  */
static int newlines2 = 0;/* Whether there is a pending CR to process.  */
static bool pending_cr = false;void
usage (int status)
{if (status != EXIT_SUCCESS)emit_try_help ();else{printf (_("\
Usage: %s [OPTION]... [FILE]...\n\
"),program_name);fputs (_("\
Concatenate FILE(s) to standard output.\n\
"), stdout);emit_stdin_note ();fputs (_("\
\n\-A, --show-all           equivalent to -vET\n\-b, --number-nonblank    number nonempty output lines, overrides -n\n\-e                       equivalent to -vE\n\-E, --show-ends          display $ at end of each line\n\-n, --number             number all output lines\n\-s, --squeeze-blank      suppress repeated empty output lines\n\
"), stdout);fputs (_("\-t                       equivalent to -vT\n\-T, --show-tabs          display TAB characters as ^I\n\-u                       (ignored)\n\-f, --show-filename      display filename at begin of each line\n\-v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB\n\
"), stdout);fputs (HELP_OPTION_DESCRIPTION, stdout);fputs (VERSION_OPTION_DESCRIPTION, stdout);printf (_("\
\n\
Examples:\n\%s f - g  Output f's contents, then standard input, then g's contents.\n\%s        Copy standard input to standard output.\n\
"),program_name, program_name);emit_ancillary_info (PROGRAM_NAME);}exit (status);
}/* Reset line number */
static void
reset_line_num (void)
{line_num_print = line_buf + LINE_COUNTER_BUF_LEN - 8;line_num_start = line_buf + LINE_COUNTER_BUF_LEN - 3;line_num_end = line_buf + LINE_COUNTER_BUF_LEN - 3;for (int i = 0; i < 17; i++){line_buf[i] = ' ';}line_buf[17] = '0';line_buf[18] = '\t';line_buf[19] = '\0';
}/* Compute the next line number.  */static void
next_line_num (void)
{char *endp = line_num_end;do{if ((*endp)++ < '9')return;*endp-- = '0';}while (endp >= line_num_start);if (line_num_start > line_buf)*--line_num_start = '1';else*line_buf = '>';if (line_num_start < line_num_print)line_num_print--;
}/* Plain cat.  Copy the file behind 'input_desc' to STDOUT_FILENO.BUF (of size BUFSIZE) is the I/O buffer, used by reads and writes.Return true if successful.  */static bool
simple_cat (char *buf, idx_t bufsize)
{/* Loop until the end of the file.  */while (true){/* Read a block of input.  */size_t n_read = safe_read (input_desc, buf, bufsize);if (n_read == SAFE_READ_ERROR){error (0, errno, "%s", quotef (infile));return false;}/* End of this file?  */if (n_read == 0)return true;/* Write this block out.  */if (full_write (STDOUT_FILENO, buf, n_read) != n_read)write_error ();}
}/* Write any pending output to STDOUT_FILENO.Pending is defined to be the *BPOUT - OUTBUF bytes starting at OUTBUF.Then set *BPOUT to OUTPUT if it's not already that value.  */static inline void
write_pending (char *outbuf, char **bpout)
{idx_t n_write = *bpout - outbuf;if (0 < n_write){if (full_write (STDOUT_FILENO, outbuf, n_write) != n_write)write_error ();*bpout = outbuf;}
}/* Copy the file behind 'input_desc' to STDOUT_FILENO.Use INBUF and read INSIZE with each call,and OUTBUF and write OUTSIZE with each call.(The buffers are a bit larger than the I/O sizes.)The remaining boolean args say what 'cat' options to use.Return true if successful.Called if any option more than -u was specified.A newline character is always put at the end of the buffer, to makean explicit test for buffer end unnecessary.  */static bool
cat (char *inbuf, idx_t insize, char *outbuf, idx_t outsize,bool show_nonprinting, bool show_tabs, bool number, bool number_nonblank,bool show_ends, bool squeeze_blank, bool show_filename)
{/* Last character read from the input buffer.  */unsigned char ch;/* Determines how many consecutive newlines there have been in theinput.  0 newlines makes NEWLINES -1, 1 newline makes NEWLINES 1,etc.  Initially 0 to indicate that we are at the beginning of anew line.  The "state" of the procedure is determined byNEWLINES.  */int newlines = newlines2;#ifdef FIONREAD/* If nonzero, use the FIONREAD ioctl, as an optimization.(On Ultrix, it is not supported on NFS file systems.)  */bool use_fionread = true;
#endif/* The inbuf pointers are initialized so that BPIN > EOB, and thereby inputis read immediately.  *//* Pointer to the first non-valid byte in the input buffer, i.e., thecurrent end of the buffer.  */char *eob = inbuf;/* Pointer to the next character in the input buffer.  */char *bpin = eob + 1;/* Pointer to the position where the next character shall be written.  */char *bpout = outbuf;while (true){do{/* Write if there are at least OUTSIZE bytes in OUTBUF.  */if (outbuf + outsize <= bpout){char *wp = outbuf;idx_t remaining_bytes;do{if (full_write (STDOUT_FILENO, wp, outsize) != outsize)write_error ();wp += outsize;remaining_bytes = bpout - wp;}while (outsize <= remaining_bytes);/* Move the remaining bytes to the beginning of thebuffer.  */memmove (outbuf, wp, remaining_bytes);bpout = outbuf + remaining_bytes;}/* Is INBUF empty?  */if (bpin > eob){bool input_pending = false;
#ifdef FIONREADint n_to_read = 0;/* Is there any input to read immediately?If not, we are about to wait,so write all buffered output before waiting.  */if (use_fionread&& ioctl (input_desc, FIONREAD, &n_to_read) < 0){/* Ultrix returns EOPNOTSUPP on NFS;HP-UX returns ENOTTY on pipes.SunOS returns EINVAL andMore/BSD returns ENODEV on special fileslike /dev/null.Irix-5 returns ENOSYS on pipes.  */if (errno == EOPNOTSUPP || errno == ENOTTY|| errno == EINVAL || errno == ENODEV|| errno == ENOSYS)use_fionread = false;else{error (0, errno, _("cannot do ioctl on %s"),quoteaf (infile));newlines2 = newlines;return false;}}if (n_to_read != 0)input_pending = true;
#endifif (!input_pending)write_pending (outbuf, &bpout);/* Read more input into INBUF.  */size_t n_read = safe_read (input_desc, inbuf, insize);if (n_read == SAFE_READ_ERROR){error (0, errno, "%s", quotef (infile));write_pending (outbuf, &bpout);newlines2 = newlines;return false;}if (n_read == 0){write_pending (outbuf, &bpout);newlines2 = newlines;return true;}/* Update the pointers and insert a sentinel at the bufferend.  */bpin = inbuf;eob = bpin + n_read;*eob = '\n';}else{/* It was a real (not a sentinel) newline.  *//* Was the last line empty?(i.e., have two or more consecutive newlines been read?)  */if (++newlines > 0){if (newlines >= 2){/* Limit this to 2 here.  Otherwise, with lots ofconsecutive newlines, the counter could wraparound at INT_MAX.  */newlines = 2;/* Are multiple adjacent empty lines to be substitutedby single ditto (-s), and this was the second emptyline?  */if (squeeze_blank){ch = *bpin++;continue;}}/* Are line numbers to be written at empty lines (-n)?  */if (number && !number_nonblank){next_line_num ();bpout = stpcpy (bpout, line_num_print);}}/* Output a currency symbol if requested (-e).  */if (show_ends){if (pending_cr){*bpout++ = '^';*bpout++ = 'M';pending_cr = false;}*bpout++ = '$';}/* Output the newline.  */*bpout++ = '\n';}ch = *bpin++;}while (ch == '\n');/* Here CH cannot contain a newline character.  */if (pending_cr){*bpout++ = '\r';pending_cr = false;}/* Are we at the beginning of a line, and filename are requested? */if (newlines >= 0 && show_filename){bpout = stpcpy (bpout, infile);*bpout++ = ':';}/* Are we at the beginning of a line, and line numbers are requested?  */if (newlines >= 0 && number){next_line_num ();bpout = stpcpy (bpout, line_num_print);}/* The loops below continue until a newline character is found,which means that the buffer is empty or that a proper newlinehas been found.  *//* If quoting, i.e., at least one of -v, -e, or -t specified,scan for chars that need conversion.  */if (show_nonprinting){while (true){if (ch >= 32){if (ch < 127)*bpout++ = ch;else if (ch == 127){*bpout++ = '^';*bpout++ = '?';}else{*bpout++ = 'M';*bpout++ = '-';if (ch >= 128 + 32){if (ch < 128 + 127)*bpout++ = ch - 128;else{*bpout++ = '^';*bpout++ = '?';}}else{*bpout++ = '^';*bpout++ = ch - 128 + 64;}}}else if (ch == '\t' && !show_tabs)*bpout++ = '\t';else if (ch == '\n'){newlines = -1;break;}else{*bpout++ = '^';*bpout++ = ch + 64;}ch = *bpin++;}}else{/* Not quoting, neither of -v, -e, or -t specified.  */while (true){if (ch == '\t' && show_tabs){*bpout++ = '^';*bpout++ = ch + 64;}else if (ch != '\n'){if (ch == '\r' && *bpin == '\n' && show_ends){if (bpin == eob)pending_cr = true;else{*bpout++ = '^';*bpout++ = 'M';}}else*bpout++ = ch;}else{newlines = -1;break;}ch = *bpin++;}}}
}/* Copy data from input to output using copy_file_range if possible.Return 1 if successful, 0 if ordinary read+write should be tried,-1 if a serious problem has been diagnosed.  */static int
copy_cat (void)
{/* Copy at most COPY_MAX bytes at a time; this is min(SSIZE_MAX, SIZE_MAX) truncated to a value that issurely aligned well.  */ssize_t copy_max = MIN (SSIZE_MAX, SIZE_MAX) >> 30 << 30;/* copy_file_range does not support some cases, and itincorrectly returns 0 when reading from the proc filesystem on the Linux kernel through at least 5.6.19 (2020),so fall back on read+write if the copy_file_range isunsupported or the input file seems empty.  */for (bool some_copied = false; ; some_copied = true)switch (copy_file_range (input_desc, nullptr, STDOUT_FILENO, nullptr,copy_max, 0)){case 0:return some_copied;case -1:if (errno == ENOSYS || is_ENOTSUP (errno) || errno == EINVAL|| errno == EBADF || errno == EXDEV || errno == ETXTBSY|| errno == EPERM)return 0;error (0, errno, "%s", quotef (infile));return -1;}
}int
main (int argc, char **argv)
{/* Nonzero if we have ever read standard input.  */bool have_read_stdin = false;struct stat stat_buf;/* Variables that are set according to the specified options.  */bool number = false;bool number_nonblank = false;bool squeeze_blank = false;bool show_ends = false;bool show_nonprinting = false;bool show_tabs = false;bool show_filename = false;int file_open_mode = O_RDONLY;static struct option const long_options[] ={{"number-nonblank", no_argument, nullptr, 'b'},{"number", no_argument, nullptr, 'n'},{"squeeze-blank", no_argument, nullptr, 's'},{"show-nonprinting", no_argument, nullptr, 'v'},{"show-ends", no_argument, nullptr, 'E'},{"show-tabs", no_argument, nullptr, 'T'},{"show-all", no_argument, nullptr, 'A'},{"show-filename", no_argument, nullptr, 'f'},{GETOPT_HELP_OPTION_DECL},{GETOPT_VERSION_OPTION_DECL},{nullptr, 0, nullptr, 0}};initialize_main (&argc, &argv);set_program_name (argv[0]);setlocale (LC_ALL, "");bindtextdomain (PACKAGE, LOCALEDIR);textdomain (PACKAGE);/* Arrange to close stdout if we exit via thecase_GETOPT_HELP_CHAR or case_GETOPT_VERSION_CHAR code.Normally STDOUT_FILENO is used rather than stdout, soclose_stdout does nothing.  */atexit (close_stdout);/* Parse command line options.  */int c;while ((c = getopt_long (argc, argv, "befnstuvAET", long_options, nullptr))!= -1){switch (c){case 'b':number = true;number_nonblank = true;break;case 'e':show_ends = true;show_nonprinting = true;break;case 'n':number = true;break;case 's':squeeze_blank = true;break;case 't':show_tabs = true;show_nonprinting = true;break;case 'u':/* We provide the -u feature unconditionally.  */break;case 'v':show_nonprinting = true;break;case 'A':show_nonprinting = true;show_ends = true;show_tabs = true;break;case 'E':show_ends = true;break;case 'T':show_tabs = true;break;case 'f':show_filename = true;break;case_GETOPT_HELP_CHAR;case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);default:usage (EXIT_FAILURE);}}/* Get device, i-node number, and optimal blocksize of output.  */if (fstat (STDOUT_FILENO, &stat_buf) < 0)error (EXIT_FAILURE, errno, _("standard output"));/* Optimal size of i/o operations of output.  */idx_t outsize = io_blksize (&stat_buf);/* Device and I-node number of the output.  */dev_t out_dev = stat_buf.st_dev;ino_t out_ino = stat_buf.st_ino;/* True if the output is a regular file.  */bool out_isreg = S_ISREG (stat_buf.st_mode) != 0;if (! (number || show_ends || squeeze_blank)){file_open_mode |= O_BINARY;xset_binary_mode (STDOUT_FILENO, O_BINARY);}/* Main loop.  */infile = "-";int argind = optind;bool ok = true;idx_t page_size = getpagesize ();do{reset_line_num();if (argind < argc)infile = argv[argind];bool reading_stdin = STREQ (infile, "-");if (reading_stdin){have_read_stdin = true;input_desc = STDIN_FILENO;if (file_open_mode & O_BINARY)xset_binary_mode (STDIN_FILENO, O_BINARY);}else{input_desc = open (infile, file_open_mode);if (input_desc < 0){error (0, errno, "%s", quotef (infile));ok = false;continue;}}if (fstat (input_desc, &stat_buf) < 0){error (0, errno, "%s", quotef (infile));ok = false;goto contin;}/* Optimal size of i/o operations of input.  */idx_t insize = io_blksize (&stat_buf);fdadvise (input_desc, 0, 0, FADVISE_SEQUENTIAL);/* Don't copy a nonempty regular file to itself, as that wouldmerely exhaust the output device.  It's better to catch thiserror earlier rather than later.  */if (out_isreg&& stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino&& lseek (input_desc, 0, SEEK_CUR) < stat_buf.st_size){error (0, 0, _("%s: input file is output file"), quotef (infile));ok = false;goto contin;}/* Pointer to the input buffer.  */char *inbuf;/* Select which version of 'cat' to use.  If any format-orientedoptions were given use 'cat'; if not, use 'copy_cat' if itworks, 'simple_cat' otherwise.  */if (! (number || show_ends || show_nonprinting|| show_tabs || squeeze_blank || show_filename)){int copy_cat_status =out_isreg && S_ISREG (stat_buf.st_mode) ? copy_cat () : 0;if (copy_cat_status != 0){inbuf = nullptr;ok &= 0 < copy_cat_status;}else{insize = MAX (insize, outsize);inbuf = xalignalloc (page_size, insize);ok &= simple_cat (inbuf, insize);}}else{/* Allocate, with an extra byte for a newline sentinel.  */inbuf = xalignalloc (page_size, insize + 1);/* Why are(OUTSIZE - 1 + INSIZE * 4 + LINE_COUNTER_BUF_LEN)bytes allocated for the output buffer?A test whether output needs to be written is done when the inputbuffer empties or when a newline appears in the input.  Afteroutput is written, at most (OUTSIZE - 1) bytes will remain in thebuffer.  Now INSIZE bytes of input is read.  Each input charactermay grow by a factor of 4 (by the prepending of M-^).  If allcharacters do, and no newlines appear in this block of input, wewill have at most (OUTSIZE - 1 + INSIZE * 4) bytes in the buffer.If the last character in the preceding block of input was anewline, a line number may be written (according to the givenoptions) as the first thing in the output buffer. (Done after thenew input is read, but before processing of the input begins.)A line number requires seldom more than LINE_COUNTER_BUF_LENpositions.Align the output buffer to a page size boundary, for efficiencyon some paging implementations.  */idx_t bufsize;if (ckd_mul (&bufsize, insize, 4)|| ckd_add (&bufsize, bufsize, outsize)|| ckd_add (&bufsize, bufsize, LINE_COUNTER_BUF_LEN - 1)|| ckd_add (&bufsize, bufsize, FILENAME_MAX + 1))xalloc_die ();char *outbuf = xalignalloc (page_size, bufsize);ok &= cat (inbuf, insize, outbuf, outsize, show_nonprinting,show_tabs, number, number_nonblank, show_ends,squeeze_blank, show_filename);alignfree (outbuf);}alignfree (inbuf);contin:if (!reading_stdin && close (input_desc) < 0){error (0, errno, "%s", quotef (infile));ok = false;}}while (++argind < argc);if (pending_cr){if (full_write (STDOUT_FILENO, "\r", 1) != 1)write_error ();}if (have_read_stdin && close (STDIN_FILENO) < 0)error (EXIT_FAILURE, errno, _("closing standard input"));return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/599361.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

stm32学习笔记:TIM-输出比较

四部分讲解内容&#xff0c;本文是第二部分 输出比较主要用于PWM波形的控制电机&#xff08;驱动电机的必要条件&#xff09; 1、定时器基本定时&#xff0c;定一个时间&#xff0c;然后让定时器每隔一段时间产生一个中断&#xff0c;来实现每隔一个固定时间执行一段程序的目…

存储过程从表中获取数据库名称

---------------业务数据库信息 CREATE TABLE [dbo].[app_erp_datbabase_conf] ( [id] [int] IDENTITY(1,1) NOT NULL, [database_type] [varchar](200) NOT NULL, [database_name] [varchar](200) NOT NULL, [create_time] [datetime] NULL, [modify_t…

linux磁盘管理实验1

1.在安装好的linux系统中新加一块硬盘&#xff0c;将硬盘分成2个主分区&#xff0c;和2个逻辑分区&#xff0c;将其中一个逻辑分区设置成vfat&#xff08;FAT32&#xff09;分区&#xff0c;并实现开机自动挂载所有分区。 答&#xff1a;添加一个硬盘为sdb 分成2个主分区&#…

Flink电商实时数仓项目部署上线

Flink实时数仓部署 将common作为一个自定义的依赖部署到maven中使用maven将各个子模块打包可以使用FLink框架进行jar包的提交运行。 StreamPark 一个易于使用的流处理应用开发框架和一站式流处理操作平台和管理流应用。它提供了Flink和Spark编写流的脚手架。 Core:可以使用…

解读 $mash 通证 “Fair Launch” 规则(Staking 玩法解读篇)

Solmash 是 Solana 生态中由社区主导的铭文资产 LaunchPad 平台&#xff0c;该平台旨在为 Solana 原生铭文项目&#xff0c;以及通过其合作伙伴 SoBit 跨链桥桥接到 Solana 的 Bitcoin 生态铭文项目提供更广泛的启动机会。有了 Solmash&#xff0c;将会有更多的 Solana 生态的铭…

项目整合积木报表-设计页面

项目整合积木报表-设计页面 <template><div><iframe id"dome" :srcsrc ></iframe></div> </template><script>export default {data(){return{src:configSrc.src"/jmreport/view/836138868821839872"}}} </…

ansible搭建和基本使用

客户端搭建 linux 安装Python&#xff08;python2版本&#xff0c;并且必须存在路径/usr/bin/python&#xff09; 安装openssh-server&#xff0c;并且配置允许root远程连接&#xff08;推荐&#xff09;windows Windows Server 2008R2客户端升级至powershell4.0 配置winrm…

SpringBoot 定时任务 + Scheduled 定时任务器

一、 任务描述&#xff1a; 需求 在于把本地 数据 推送到 第三方 平台的数据库&#xff0c;实现T1 增量&#xff1b; 二、实现用到技术 &#xff08;1&#xff09;Scheduled 定时任务器 Spring 3.0 之后&#xff0c;框架自带的定时任务&#xff1b; &#xff08;2&#x…

【C语言】函数

函数是什么&#xff1f; “函数”是我们早些年在学习数学的过程中常见的概念&#xff0c;简单回顾一下&#xff1a;比如下图中&#xff0c;你给函数 f(x)2*x3 一个具体的x,这个函数通过一系列的计算来返回给你一个结果(图示如下)。 这就是数学中函数的基本过程和作用。但是你…

LeetCode-杨辉三角公式

杨辉三角公式 ![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/a225ff66061e4076924e3299b81b98d5.png /*** author wx* description 杨辉三角公式-标准* create 2023/12/26**/ public class Triangle {public static void main(String[] args) {List<List<I…

【智慧零售】东胜物联蓝牙网关硬件解决方案,促进零售门店数字化管理

依托物联网&#xff08;IoT&#xff09;、大数据、人工智能&#xff08;AI&#xff09;等快速发展&#xff0c;数字化和智能化已成为零售企业的核心竞争力。更多的企业通过引入人工智能、大数据等先进技术手段&#xff0c;提高门店运营效率和服务质量。 某连锁咖啡企业牢牢抓住…

C++程序设计兼谈对象模型(侯捷)笔记

C程序设计兼谈对象模型&#xff08;侯捷) 这是C面向对象程序设计的续集笔记&#xff0c;仅供个人学习使用。如有侵权&#xff0c;请联系删除。 主要内容&#xff1a;涉及到模板中的类模板、函数模板、成员模板以及模板模板参数&#xff0c;后面包含对象模型中虚函数调用&…

原生JS和jQuery请求接口

原生JS请求接口 get请求 //步骤一:创建异步对象 var ajax new XMLHttpRequest(); //步骤二:设置请求的url参数,参数一是请求的类型,参数二是请求的url,可以带参数,动态的传递参数starName到服务端 ajax.open(get,getStar.php?starNamename); //步骤三:发送请求 ajax.send()…

SSMBUG汇总

20240103 通用&#xff0c;驼峰命名法&#xff0c;mybatis。 mybatis入门程序中&#xff0c; // 获取对象的顺序为&#xff1a;SqlSessionFactoryBuild-》SqlSessionFactory-》SqlSessionSqlSessionFactoryBuilder sqlSessionFactoryBuilder new SqlSessionFactoryBuilder();I…

vue3-admin-element框架实现动态路由(根据接口返回)

第一步&#xff1a;在src-utils-handleRoutes&#xff0c;修改代码&#xff1a; export function convertRouter(routers) {let array routersrouters []for (let i in array) {for(let s in asyncRoutes){if (array[i].path asyncRoutes[s].path) {routers.push(asyncRout…

Flutter应用中安卓和IOS的一些权限配置

在Flutter应用中&#xff0c;无论是安卓(Android)还是iOS设备&#xff0c;都可能需要向用户请求权限以访问特定的设备功能或用户数据。以下是一些常用的权限&#xff1a; 安卓设备常用权限 android.permission.CAMERA&#xff1a;使用设备的摄像头android.permission.ACCESS_…

<sa8650>sa8650 qcxser-之-QCX错误报告接口

<sa8650>sa8650 qcxser-之-QCX错误报告接口 1 前言2 错误报告设计3 报告错误的QCarCam APIs3.1 错误ID3.2 错误code3.3 错误源4 错误报告流1 前言 本章主要讲解QCX服务的错误报告接口,如何将qcxserver的错误诊断信息报告给Safety Monitor。 2 错误报告设计 图2-1显示了通…

HTTP与API接口详解

什么是HTTP HTTP&#xff08;Hypertext Transfer Protocol&#xff09;是用于传输和接收Web页面、图像、音频、视频和其他资源的应用层协议。它是互联网上数据传输的基础&#xff0c;使得客户端&#xff08;例如浏览器&#xff09;能够与服务器之间进行通信。 HTTP是基于请求…

Spring官方移除Java8

大家好我是苏麟 , 今天聊聊怎么继续使用Java8做项目 . 在做项目的时候突然发现Java8没了 , 我心想 : " 嗯? IDEA出毛病了?" ,经过我仔细检查原来是spring官方不支持Java8了 . IDEA 内置的 Spring Initializr 创建 Spring Boot 新项目时&#xff0c;没有 Java 8 的选…

数据结构和算法-希尔排序(增量序列 算法实现 性能分析 稳定性)

文章目录 希尔排序过程小结增量序列不是固定的 算法实现算法性能分析稳定性小结 希尔排序 基本有序&#xff0c;就是存在有序的子序列 通过增量4得到各个子表 对各个子表分别进行插入排序 缩小增量&#xff0c;再除2&#xff0c;此时的子表 对各个子表插入排序 缩小增量&…